function useSet(array =[1,2,4,3,5,1,2]){return Array.from(new Set(array))// return [...new Set(array)];}
2.使用includes
function useIncludes(array =[1,2,4,3,5,1,2]){
let newArray =[];for(let index =0; index < array.length; index++){const element = array[index];if(!newArray.includes(element)){
newArray.push(element);}}return newArray;}
3.indexOf
function useIndexOf(array =[1,2,4,3,5,1,2]){
let newArray =[];for(let index =0; index < array.length; index++){const element = array[index];if(!(newArray.indexOf(element)>-1)){
newArray.push(element);}}return newArray;}
function useMap(array =[1,2,4,3,5,1,2]){
let map = new Map();
let newArray =[];
array.forEach(it =>{if(map.has(it)){
map.set(it,true);}else{
map.set(it,false);
newArray.push(it);}})return newArray;}