let arr1 = ['a','b','c','d']; let arr2 = [1,4];//通过这个数组过滤掉arr1中索引为1跟4的选项
Bolehkah ini dicapai menggunakan penapis
let arr1 = ['a','b','c','d']; let arr2 = [1,4]; arr1.filter((value,index)=>{ return arr2.indexOf(index) === -1; });
arr1.filter(function(){ for(let i = 0 , i < arr2.length, i++){ return arr1[arr2[i]] } })
let newArr = arr1.filter((el, index, array) => { return arr2.indexOf(index) === -1 })
let newArr = arr1.filter((el, index, array) => { return !arr2.includes(index) })
arr1 = arr1.filter((e,i) => arr2.indexOf(i)===-1)Subskrip bermula dari 0
arr1 = arr1.filter((e,i) => arr2.indexOf(i)===-1)
Subskrip bermula dari 0