function dropElements(arr, func) {
while (func(arr[0])===false){
var filteredarray= arr.slice();
break;
}
console.log(filteredarray);
return filteredarray
}
dropElements([0, 1, 0, 1], function(n) {return n === 1;});
I don´t understand why this isn´t working. Could someone explain?