I need to push a new array as the value of a parent array key.
this is my array.
asd[
[hey],
[hi]
]
i would like to return.
asd[
[hey]=>[],
[hi]
]
i do:
var asd = new Array();
asd.push(hey);
asd.push(hi);
asd[hey].push(new Array());
so obviously is not ok my code
Instead of
new Array();you should just write[]. You can create a nested array like thisRemember that when you push things into an array, it’s given a numerical index. Instead of
asd[hey]writeasd[0]sinceheywould have been inserted as the first item in the array.