4 ms·
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-s
by pkulak 15y ago
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
- mikeryan 15y agoAs stated above Javascript does not do this it has separate array and Object types. Javascript developers might.
- voyou 15y agoNo it doesn't. Arrays are a type of Object, they're not distinct.
- masklinn 15y ago> JavaScript does it No, javascript does not.
- pkulak 15y agozoidberg:~ phil$ node > a = {} {} > a[1] = 56 56 > a['1'] 56 > a = [null, 56] [ null, 56 ] > a['1'] 56 > a[1] 56 > typeof a 'object'