用ES6语法实现简单数组去重 var str = [1,2,2,3,8,7,65,2];var res = [];str.forEach(s = { if (!res.includes(s)) { res.push(s) }})console.log(res)
var str = [1,2,2,3,8,7,65,2]; var res = []; str.forEach(s => { if (!res.includes(s)) { res.push(s) } }) console.log(res)