RSS
 

Javascript Loop: Multidimensional Associative Arrays

04 Oct

Had a problem I came across, looping through a multidimensional associative array in JavaScript.

 var oldToNewMap = {   id1: { attrib1: "value1" },   id2: { attrib2: "value2" } };

//loop through mapping array  for (var id in oldToNewMap)  {   for (var attrib in oldToNewMap[id])   {                                var new = oldToNewMap[id][attrib];    whatever(id, attrib, new);   }  }
VN:F [1.9.3_1094]
Rating: 6.0/10 (1 vote cast)
VN:F [1.9.3_1094]
Rating: -1 (from 1 vote)
Javascript Loop: Multidimensional Associative Arrays, 6.0 out of 10 based on 1 rating
Retweet
 
1 Comment

Posted in Personal

 
  1. DarrenPRILEREURSERT

    May 20, 2010 at 10:22 am

    The best forum so far

    VA:F [1.9.3_1094]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.3_1094]
    Rating: 0 (from 0 votes)