Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js 数组方法总结 & 各方法是否改变原数组 #29

Open
dongtianqi opened this issue Jun 6, 2019 · 0 comments
Open

js 数组方法总结 & 各方法是否改变原数组 #29

dongtianqi opened this issue Jun 6, 2019 · 0 comments

Comments

@dongtianqi
Copy link
Owner

不会改变原来数组的有:
concat()---连接两个或更多的数组,并返回结果。

every()---检测数组元素的每个元素是否都符合条件。

some()---检测数组元素中是否有元素符合指定条件。

filter()---检测数组元素,并返回符合条件所有元素的数组。

indexOf()---搜索数组中的元素,并返回它所在的位置。

join()---把数组的所有元素放入一个字符串。

toString()---把数组转换为字符串,并返回结果。
lastIndexOf()---返回一个指定的字符串值最后出现的位置,在一个字符串中的指定位置从后向前搜索。

map()---通过指定函数处理数组的每个元素,并返回处理后的数组。

slice()---选取数组的的一部分,并返回一个新数组。

valueOf()---返回数组对象的原始值。

-----------分割线-------------------

会改变原来数组的有:
pop()---删除数组的最后一个元素并返回删除的元素。

push()---向数组的末尾添加一个或更多元素,并返回新的长度。

shift()---删除并返回数组的第一个元素。

unshift()---向数组的开头添加一个或更多元素,并返回新的长度。

reverse()---反转数组的元素顺序。

sort()---对数组的元素进行排序。

splice()---用于插入、删除或替换数组的元素。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant