数组变异
Posted janicedong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数组变异相关的知识,希望对你有一定的参考价值。
在把原来的数组替换成新的数组时
this.classlistIds = this.classIndex
这样直接给数组赋值是不可以的,要用数组变异方法oldArray.concat(newArray)
正确的方法是:
this.classlistIds.concat(this.classIndex)
以上是关于数组变异的主要内容,如果未能解决你的问题,请参考以下文章
JavaScript数组方法: 变异方法 (mutation method)和非变异 (non-mutating method)