Javascript Array Extension – Key value pair

Published on Monday, August 27, 2012

I went totally frustrated earlier when I tried to find a way to match key values to value in arrays (hashmap kind). But I couldn’t find any function for that in javascript. So I decided to write my own extension for the array in javascript. Here is the result. Mind you, it’s only in alpha release. Basic usage:

>> p = new Array();
>> p.add('key', 'value');
>> p.add('ha', 'xxor');
>> p;
["value", "xxor"]
>> p.get('key');
>> p.remove('ha');
>> p;


Download JavaScript Array extension

comments powered by Disqus