how to concatenate (variable + object key names) to get the object values in dot notation [duplicate]
问题 This question already has answers here : Add a property to a JavaScript object using a variable as the name? (13 answers) Closed 4 years ago . Assuming I've a JSON object like this: var myObj = { 'question1': { 'option1': 'foo', 'option2': 'bar', 'option3': 'baz' }, 'question2': { ... }, 'question3': { ... } }; And since its children always has a number in its keys, I want to do a loop and concatenate the loop's index to the object keys, and get the values in the dot notation method... So, I