Which JavaScript Array functions are mutating?

a 夏天 提交于 2019-11-28 04:19:30
Jonathan Lonowski

You can find the list on MDN as Mutator methods (along with Accessor and Iteration methods):

You can also use .concat(), before using your mutation method, to ensure you are not mutating your arrays, eg

const dontMutateMe = [4,5,1,2,3];
const sortArray = dontMutateMe.concat().sort(...)

I found this website called Doesitmutate

Have the list of all functions - and tells whether it mutates or not.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!