Saturday, 15 January 2011

Do I need to specify position when adding a new object to an array in Javascript? -


I have an array in javascript with three elements

now I (Id: 0, name: "Page"}

P>

  {id: 99, name: "All"}   

To do this, I must specify that this array is in position 4 or is there any easy way I can add it to the result?

If you have an array called 'result', then you just need to get the result in the original Use the array method .push () This method will add to the end of the array.

Example.

  Results Push (object)    

No comments:

Post a Comment