Quick actions

cmd+k|ctrl+k

Navigation

Languages

Loop

Snippet info

Language

JavaScript

Visibility

public

Author

erdianus

Created

2020-04-13T14:55:44Z

Updated

2020-04-13T14:55:44Z

const myArray = ["Harry", "Ron", "Hermione", "Tom"];
for(let i = 0; i < myArray.length; i++) {
    console.log(myArray[i]);
}
/* output
Harry
Ron
Hermione
Tom
*/

//FOR OF LOOP
let MyArray = ["Harry", "Ron", "Hermione", "Tom"];
 
for(const arrayItem of MyArray) {
    console.log(arrayItem)
}
 
/* output
Harry
Ron
Hermione
Tom
*/
INFO