javascript - Dynamically getting values of objectliteral without knowing key value names -


i have object this

obj{quest1:{header1:1}, quest2:{header2:2}, quest3:{header3:3} } 

how access poperty names... via quest1,quest2, quest3 how access inner property names... via header1,header2,header3
and
values.. 1,2, 3 dynamically in loop

for pure js solution, can use loop:

for(var k in obj) {   (var k2 in obj[k]) {     console.log('property : ' + k + ', inner ' + k2 + ', value ' + obj[k][k2]);   }  } 

prints

property quest1, inner header1, value 1 property quest2, inner header2, value 2 property quest3, inner header3, value 3 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -