19 JavaScript array

Creating an array:

  • 1 var array = [ "a", "b", "c"]; create an array text  
  • 2 var array = new Array ( "a", "b", "c"); to create an array of objects embodiment

In the readable aspect, simplicity, speed of execution and other considerations, it is recommended to use the first

 

Add an array element: array.push ( "demo");

 

Guess you like

Origin www.cnblogs.com/ltfxy/p/11799063.html