typescript学习

1、typescipt数组去重

//TypeScript 数组去重只需一行代码即可实现:
this.menuids = Array.from(new Set(this.menuids))

2、typescript过滤

//typescript中的数组 默认只有push、pop这样的增删api。 如果想移除数组中间的某一项元素, 可以通过:
let node: int;  //要移除的对象
nodes: int[];

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

你可能感兴趣的:(typescript)