Dictionary inside dictionary in javascript -


i have data sets. example, a,b , c. there sets of these values. example:-

[a:asd, b:ajs, c:aknd], [a:sdf, b:gss, c:fdss], [a:ijq, b:cba, c:jqwd] 

etc.

now want make dictionary containing these values separate dictionaries. example:-

{        {         a:asd,         b:ajs,         c:aknd     },     {            a:sdf,         b:gss,         c:fdss     },     {         a:ijq,         b:cba,         c:jqwd     } } 

can me out this. tried doing it's not making dictionary.

for( var i=0; i< n; i++) {     data += {                 "a":value1,                 "b":value2,                 "c":value3      } } 

any inputs?

this not make sense in javascript:

{        {         a:asd,         b:ajs,         c:aknd     },     {            a:sdf,         b:gss,         c:fdss     },     {         a:ijq,         b:cba,         c:jqwd     } } 

if intend have object (dictionary) integer keys, so:

var data = {};  for( var i=0; i< n; i++) {     data[i] = {                 "a":value1,                 "b":value2,                 "c":value3      } } 

depending bit on you're trying do, array better choice:

var data = [];  for( var i=0; i< n; i++) {     data.push({                 "a":value1,                 "b":value2,                 "c":value3      }); } 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -