Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Different output with node and "Run code snippet" from stackoverflow in js

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 ]
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!