如何在typescript中移除数组中某一项

版权声明:.net/web/医疗技术的木子纵横的个人分享 https://blog.csdn.net/muzizongheng/article/details/85246911
typescript中的数组 默认只有push、pop这样的增删api。 如果想移除数组中间的某一项元素, 可以通过:


let node: int;  //要移除的对象
nodes: int[];

this.nodes = this.nodes.filter(item => item !== node);

猜你喜欢

转载自blog.csdn.net/muzizongheng/article/details/85246911
今日推荐