I have a file in c:\jsdev\ folder called script.js
with this source code:
const arr = [3, 'myStr', 5, 7];
arr.foo = 'hello';
for (let i in arr) {
console.log(i); // logs "0", "1", "2", "foo"
}
console.log(arr);
When I run this in cmd
c:\jsdev>node script.js
I get following output
0
1
2
3
foo
[ 3, 'myStr', 5, 7, foo: 'hello' ]
Picture of my cmd shell in Windows 10
But when I press the Run code snippet (try it out now in stackoverflow), it just outputs
[ 3, 'myStr', 5, 7 ]