Es6的set用法
链接:https://www.nowcoder.com/questionTerminal/fbe541dfca37499a9713c1bcc862bc40?toCommentId=7804070
来源:牛客网
哪位大神指点迷津一下呀😓
来源:牛客网
Array.prototype.noRepeat = () => { return [...new Set(this)]; } //这里有个奇怪的问题 let arr = [1,2,3,4,5,4,3] let a1 = arr.noRepeat() // a1 [1, 2, 3, 4, 5] let arr2 = ['a','b','c','d','b','a'] let b = arr2.noRepeat() // b [1, 2, 3, 4, 5],这里为什么会报错呢??? | |