每日面试题3
1.数组去重
function qc(arr2){ let arr = []; for( let i = 0; i < arr1.length; i++) { if( arr.indexOf(arr1[i]) == -1) { arr.push(arr1[i]) } } return arr; } arr1 = ["1","1","3","5","2","24","4","4","a","a","b"]; console.log(qc(arr1));
勤学似春起之苗,不见其增,日有所长; 辍学如磨刀之石,不见其损,日所有亏!