+ 1

Is there any way to nest an object inside of another object without key property?

E.g. var a = { {val:1}, {val:2} }; var b = {val:3} I want ro nest var b inside of var a.

15th Sep 2020, 2:49 PM
Wagner Alves dos Santos
Wagner Alves dos Santos - avatar
5 odpowiedzi
+ 4
Use an array. var a = [ { val: 1, }, { val: 2, }, ];
15th Sep 2020, 2:58 PM
Ore
Ore - avatar
+ 2
Wagner Alves dos Santos Your question says "with no key property". What exactly do you want?
15th Sep 2020, 3:01 PM
Ore
Ore - avatar
+ 1
U mean objects nested in an array looks like pretty good to me. Thank you
15th Sep 2020, 3:03 PM
Wagner Alves dos Santos
Wagner Alves dos Santos - avatar
0
I need to use key properties inside the objects nesteds
15th Sep 2020, 3:00 PM
Wagner Alves dos Santos
Wagner Alves dos Santos - avatar
0
*nested object
15th Sep 2020, 3:01 PM
Wagner Alves dos Santos
Wagner Alves dos Santos - avatar