rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

a.without(1) vs a.without('1') #112

Closed Poordeveloper closed 8 years ago

Poordeveloper commented 8 years ago

a.set(1, 2) a.without(1) does not work, but '1' works.

rtfeldman commented 8 years ago

This is because JavaScript objects only use strings for keys, not numbers.

Poordeveloper commented 8 years ago

But a[1] and a['1'] both work, how do you explain?

rtfeldman commented 8 years ago

JavaScript treats a[1] as the same as a["1"] when a is an object.