-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new Map()
is broken
#526
Comments
@loveencounterflow Maps are not like arrays, you must use (This can be closed) |
To set a key, you should use the .set() method of the Map object, so you would use d.set( [ 1, 2, ]) = 42. Then everything works as expected. |
this would be a v8 bug, not an iojs bug. That said, I don't believe this is valid.
However, these object properties are not entries in the map, as far as the map is concerned (thus, doesn't show up in map entries/keys/values). it behaves |
ah i see. my bad, should've read the docs! sadly, this also means that maps are no drop-in replacements for plain old objects. i tried the examples from the MDN site, everything seems ok (when using |
ES6 maps do not seem to work as described in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map; specifically,
var d = new Map(); d[ [ 1, 2, ] ] = 42;
will cause a key'1,2'
to be created, and allows to retrieve the value withd[ '1,2' ]
. Moreover,d.forEach
will not iterate,d.size
will always be0
,d.has(...)
always returnsfalse
, and bothd.keys()
andd.values()
will always return an empty object{}
, which is wrong on more than one level.The text was updated successfully, but these errors were encountered: