Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Actually, for ... in does both.

It is you who doesn't think that loop does what it actually does.

Please read the spec and verify with your favorite JS runtime before continuing this argument.



    for (x in [6,1,6,2,6,3]) {
      console.log(x);
    }
Please run this in your browser console and tell me if it iterates over the elements of the array.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: