How can I add an object to an array (in javascript or jquery)? For example, what is the problem with this code?
function(){
var a = new array();
var b = new object();
a[0]=b;
}
I would like to use this code to save many objects in the array of function1 and call function2 to use the object in the array.
- How can I save an object in an array?
- How can I put an object in an array and save it to a variable?
push
has been suggested multiple times here already. Please, do not pollute this thread anymore with anotherpush
suggestion. – Boghyon Hoffmann Apr 14 '18 at 14:17