Assuming I have an array
let arr = [
[0,1,0,4],
[1,0,1,2],
[0,0,1,1],
[0,1,0,1]
];
I want to loop through the array with a higher order array function, and return an array where all values that are not equal to n (in my case let's say n=0) will be stacked against the end of the array:
console.log( arr.map( certainFunction ) );
//returns this;
[ [0,0,1,4],
[0,1,1,2],
[0,0,1,1],
[0,0,1,1] ]
Is it possible using higher order functions to loop through arr and return the array above?
Then how will the certainFunction look?