Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

in vs of javascript

const arr = [3, 5, 7];
arr.foo = "hello";
    
for (const i in arr) {
  console.log(i); // 0, 1, 2, foo
}
    
for (const i of arr) {
  console.log(i); // 3, 5, 7
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript
ADD COMMENT
Topic
Name
7+6 =