Re:KindScript – A kinder JavaScript experience
by chowells on Sunday March 20, 2016 @11:49AM
(#11323345)
That solution doesn't cast javascript in a positive light.
Why should you need to know that much about the guts of the language just to create an associative array that works properly?
Re:KindScript – A kinder JavaScript experience
by joshuacc on Sunday March 20, 2016 @12:11PM
(#11323421)
JavaScript objects aren't associative arrays. They inherit property values from their prototype. Not just __proto__, but hasOwnProperty, etc. If you want to abuse objects in this way, it makes sense that you need a special approach to opt out of inheritance.
A better approach is to just use Map.
var m = new Map();
Problem solved.