I have the following array
var array = [[0],[0],[0],["noteremove",1],[10],["notremove",1]]
Which i want to end looking like:
[["noteremove",1],[10],["notremove",1]]
Meaning that all [0] should be purged.
I have this, but it doesnt work:
function arraysEqual(a1,a2) {
return JSON.stringify(a1)==JSON.stringify(a2);
}
var array = [[0],[0],[0],["noteremove",1],[10],["notremove",1]]
for (let i = 0; i< array.length;i++){
if(arraysEqual(array[i],[0])){
console.log("its equal")
array.splice(i,1)
}
}
console.log(array); //It logs
//[ [ 0 ], [ 'noteremove', 1 ], [ 10 ], [ 'notremove', 1 ] ]
//The initial 0 shouldnt be there