Alex Rivera | Logout

Add to Array jQuery

Asked 2011-05-02T19:58:46.703
117

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...

Edit
Report

1 Answer

15

You are right. This has nothing to do with jQuery though.

var myArray = [];
myArray.push("foo");
// myArray now contains "foo" at index 0.
answered 2011-05-02T20:00:41.560

Your Answer