I know how to initliaize one but how do add I items to an Array? I heard it was push() maybe? I can't find it...
push()
For JavaScript arrays, you use push().
var a = []; a.push(12); a.push(32);
For jQuery objects, there's add().
add()
$('div.test').add('p.blue');
Note that while push() modifies the original array in-place, add() returns a new jQuery object, it does not modify the original one.
548k questions
547k answers
4 comments
86.3k users