javascript - Get key value of dictionary by index in jQuery -


i have javascript dictionary object has pre-set keys defaulted 0. need loop through elements of dictionary index , use value of key set value. below code make things easier understand:

var _map = {     'severity-normal': 0,     'severity-minimal': 0,     'severity-moderate': 0,     'severity-severe': 0,     'severity-highly-severe': 0 };      mapseverities: function () {         (var = 0; < _map.length; i++) {             //get key value, ex: severity-normal, index (which i)             var key = //retrieved key value             _map[key] = this.data(key);         }     } 

in other words, suppose we're dealing c#, want keyvaluepair @ index, access key , value properties.

any suggestions?

for object _map, should use for .. in.

for (var key in _map) {   _map[key] = this.data[key]; } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -