去除数组中的重复元素

    技术2022-07-11  108

    function dedupe(array){ return Array.from(new Set(array)); //这里的 Array.from()方法是将两类对象转为真正的数组:类似数组的对象和可遍历的对象(包括es6新增的数据结构Set和Map) }  dedupe([1,1,1,2,3]) //[1,2,3]

    参考博客地址https://www.cnblogs.com/shj-com/p/7458510.html

    Processed: 0.011, SQL: 9