2/9/13

javascript wish

I love that javascript allows { a : 1, b : 2 } and doesn't require { "a" : 1, "b" : 2 } like python does.

But python has an advantage, which is that you can use a variable as a key.

I wish javascript allowed variables as keys, like this { [a] : 1, [b] : 2 }, analogous to the way brackets are used to allow variables as keys when indexing into a hashmap like this x[a].

No comments:

Post a Comment