

Map JavaScript API - nkron
http://www.javascripture.com/Map

======
miohtama
It lacks the same syntatic sugar as Python dicts :(

------
maratd
> console.log(x.size);

This is annoying. Is there some reason x.length wasn't used?

~~~
nickmain
length implies an ordered sequence.

------
bonif
Great ! We can use forEach !

Maybe in Ecmascript 7 we'll finally get rid of

var me = this;

~~~
timothya
Even today, you shouldn't need to write code like that. Just bind functions to
the current scope. That looks something like this (imagine this code is in the
context of some object):

    
    
        element.addEventListener('click', function(e) {
          this.foo();
        }.bind(this), false);
    

Notice the call to "bind" which binds the click handler function to the
current object, so that inside it can call this.foo().

~~~
bshimmin
Totally. And if you do need to support older browsers without a native `bind`,
Underscore is your friend. There's not been a need to write `var me = this` or
similar for a long time (or ever, really) but unfortunately you do still see a
lot of - even very recent - code littered with it.

~~~
dcherman
Is it really unfortunate? It's a matter of opinion. I find a single `var self
= this;` to be much more readable than many .bind(this) calls when you're
several levels deep.

