The method used an array of objects

1.concat

 Connect two or more arrays and returns a new array, and does not affect the other array

Return Value: Returns a new array

Parameters: An array may be connected to a plurality of names may also be a

2.every

  Detecting whether each element in the array are eligible

Returns: If the array has a non-compliance to compliance with all returns false returns true

Parameters: two parameters first parameter is a callback function (a function parameter)

           The second parameter is an object, alternatively, to replace this in the callback function 

obj here, the callback function callback points to an object that is a window into the object obj obj console output

3.filter

The detection elements in the array, return the new array element composed of qualified

Return Value: returns a new array

Parameters: the first one is the callback

4.find

Each element in the array are called once, and then return the first matching element

Return Value: returns the first matching element

Parameters: the first one is the callback, must have a return value

           The second is to replace this refers to

5.findIndex

Usage and find the same, not the same as findIndex is executed every element in the array once and returns the first element does not meet the conditions

6.forEach

Calling function of each element and passed to the callback forEach element with the same through each element of the for loop

No return value 

Parameters: The first parameter is the callback

    The second object of this is to replace callback

7.map

Returns a new array, the array element is performed after the return value of the callback

Return Value: returns an array

Parameters: The first parameter is the callback callback must return a value

      The second parameter in this alternative callback

8.includes

 Analyzing an array contains a specified value has no returns true returns false

Return value: boolean

Parameters: The specified value

9.indexOf

Search for a location in the array element with its index is returned, it is not -1

Returns the index value of the digital -1

Parameters: The specified value

10.join

All elements in the array will be converted into a string

返回值:返回一个新的字符串

参数:指定的分隔符,不填的话默认是逗号(,)

11.push

向数组的末尾添加新的元素,修改原来的数组

返回值:新数组的长度

参数:元素

12.pop

删除数组中的最后一个元素,修改原来的数组

返回值:返回的是删除的那个元素

无参数

13.reduce   迭代

当前元素在回调函数中的操作,离不开前一个元素的返回值,一般从第二项开始执行

返回值:参数第一个参数是一个回调函数,必须有返回值否则都是undefined。

1.回调函数的第一个参数是 total (total 是前一个元素所对应的回调函数返回值)

2.回调函数的第二个参数是当前元素

3.回调函数的第三个参数是当前元素对应的索引值

第二个参数是一个初始值如果写了,reduce从第一项开始执行,把这个初始值当作第一项回调里的total,如果不写,从第二项开始执行,第一个元素就是第二项里的total。

14.reverse() 

将数组顺序反转

返回值:反转后的数组,改变了原数组

参数:没有参数

15.unshift() 

在数组的开头添加一个或多个元素

返回值 :返回添加后数组的新长度

参数 :要添加的元素

16.shift()

删除数组中的第一个元素

返回值 :返回被删除的那个元素

参数 :没有参数

17.slice()

从原数组中截取并返回一部分元素;

返回值:一个新数组截取到的元素构成的新数组

参数开始的位置和结束的位置(不包含最后一个元素)

18.some()

检索数组中是否有符合条件的元素,只要有一个符合返回true,全不符合返回false

返回值:boolean

参数:一个回调函数回调函数里必须有返回值

19.sort()

对数组的元素进行排序按0-9-a-z顺序排列

返回值:排列后的新数组

参数: callback

20.splice()

从数组中指定的某一项开始删除元素或添加新元素会改变原有的数组

返回值:一个数组如果删除了元素返回的是这写删除元素构成的新数组

(如果没有删除返回的是一个空数组)

 参数 :第一个参数必须填起始位置

 第二个参数 , 删除元素的个数可以是0 代表没有删除不填删除后面所有的

 第三类参数  ,从第三个参数开始后面都是添加的新元素

21.toString()

将数组转化为字符串并返回这个字符串

返回值 :转化后的字符串

参数:没有参数

Guess you like

Origin www.cnblogs.com/gaoyijing/p/gao--yi----jing.html