1. Create an array

1. Use the Array constructor

var arr1 = new Array(a);// Create an empty array
var arr2 = new Array(20);    // Create an array of length 20
var arr3 = new Array("lily"."lucy"."Tom");   // Create an array of three strings
Copy the code

2. Create array literals

var arr4 = [];   // Create an empty array
var arr5 = [20];   // Create an array of 1 items
var arr6 = ["lily"."lucy"."Tom"];   // Create an array of three strings
Copy the code

2. Array methods

push      pop
unshift   shift
join
sort
reverse
concat
slice
splice
indexOf()    lastIndexOf()
forEach
map
filter
every
some
reducer    reducerRight
Copy the code