0

I want to create an array that displays element like below using Js/Jquery

0=>{[0]=>112,[1]=>'my 1st element array',[2]=>'tet1',[3]=>200}
1=>{[0]=>113,[1]=>'my 2nd element array',[2]=>'test2',[3]=>300}
2=>{[0]=>114,[1]=>'my 3rd element array',[2]=>'test3',[3]=>400}

Then I'll be pushing or adding elements to it dynamically. Eg After adding my array should become like below

0=>{[0]=>112,[1]=>'my 1st element array',[2]=>'tet1',[3]=>200}
1=>{[0]=>113,[1]=>'my 2nd element array',[2]=>'test2',[3]=>300}
2=>{[0]=>114,[1]=>'my 3rd element array',[2]=>'test3',[3]=>400}
3=>{[0]=>115,[1]=>'my 4th element array',[2]=>'test4',[3]=>500}

How shall I achieve this.Any help is really appreciated.Thanks!

3
  • use .push() method to add more elements into array.. Commented Apr 15, 2015 at 4:59
  • Any JavaScript tutorial about arrays will explain how to add elements to an array: developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/… Commented Apr 15, 2015 at 5:00
  • Thanks @BrijeshBhatt.But can you let me know how shall i create the array. Commented Apr 15, 2015 at 5:00

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.