Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

For Of Loop

    const letters = ["a","b","c", "d", "e","f"];

for (const x of letters) {
 console.log(x)
}
/*note that for of only works for iterable objects(which includes an array). The above type of code would NOT work for a JSON for example*/
/*for example for something like 
const x = {0:0, 1:2222, 2:44444}, you can only use for ... in as JSON is not an iterable*/
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #For #Of #Loop
ADD COMMENT
Topic
Name
2+1 =