Tell us what’s happening:
Your code so far
function dropElements(arr, func) {
var length = arr.length;
var continua = 1;
for (var i = 0; i < times; i++) {
if (func(arr[0])) {
continua = 0;
}
else {
arr.shift()
}
}
return arr
}
dropElements([1, 2, 3], function(n) {return n < 3; });
Why when I don’t assign length to arr.length and loop through the array like this:
for ( var i = 0; i < arr.length; i++) {
}
it does not pass one of the tests? Isn’t that a bug?