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

Using the same object for arrays and hashes seems like a terrible idea long before thinking about it this much. JavaScript does it, but JS goes for this super-simple, everything-is-a-function-hash-thing simplicity


As stated above Javascript does not do this it has separate array and Object types. Javascript developers might.


No it doesn't. Arrays are a type of Object, they're not distinct.


> JavaScript does it

No, javascript does not.


  zoidberg:~ phil$ node
  > a = {}
  {}
  > a[1] = 56
  56
  > a['1']
  56
  > a = [null, 56]
  [ null, 56 ]
  > a['1']
  56
  > a[1]
  56
  > typeof a
  'object'




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

Search: