Results 2 comments of GeWei

> > arr.toString()。split(“,”)。sort((a,b)=> {return ab}) > > 你可能后面需要 `arr.toString().split(",").sort((a,b)=>{ return a-b}).map(Number) ` > 不然数组元素都是字符串 结果并没有去重 还有两个2 5和12 [... new Set(arr.toString().split(",").sort((a,b)=>{ return a-b}).map(Number))]

现在项目基本都会用babel-polyfill去做转码的 ------------------ 原始邮件 ------------------ 发件人: "Angular"; 发送时间: 2019年7月10日(星期三) 上午10:30 收件人: "Advanced-Frontend/Daily-Interview-Question"; 抄送: "每一天"; "Comment"; 主题: Re: [Advanced-Frontend/Daily-Interview-Question] 第 11 题:将数组扁平化并去除其中重复数据,最终得到一个升序且不重复的数组 (#8) Array.from(new Set(arr.flat(Infinity))).sort((a,b)=>{ return a-b}) 这个目前低版本浏览器是不支持的 需要es7 babel支持 — You...