【发布时间】:2017-10-26 10:13:49
【问题描述】:
我想在 Ionic3 中删除存储数组中的重复值
this.storage.get('thestations').then((val) => {
for(let i =0;i<val.length;i++){
if(this.newarray.indexOf(this.newarray) == -1) {
this.newarray.push(val[i]);
}
console.log(newarray);
});
但它仍然返回重复值
【问题讨论】:
-
val 对象的格式是什么?
-
请用您的数组更新问题。
-
您正在测试 newarray 中的一项是否与整个 newarray 匹配,我怀疑这是您的目标。
标签: javascript arrays angularjs ionic-framework