Hi there,
Trying to slog through the lodash exercise and it seems my code is calculating the wrong dropNumber or something?
This is my first post - I did try to search for a solution, but I couldn’t find one - and I don’t know if I’m formatting the question properly!
dropWhile(array, predicate) {
let dropNumber = array.findIndex((element, index) =>{!predicate(element, index, array)});
let newArray = this.drop(array, dropNumber);
return newArray
},
The error message I get is…
_.dropWhile() Tests:
1 - _.dropWhile() is defined - Passed!
2 - Returns an array - Passed!
3 - Drops elements until predicate function returns falsy - Failed: _.dropWhile([1, 2, 0, 4], indexIsSmallerThanElement returned [ 4 ] instead of [ 0, 4 ].
I’m not sure why this is happening - I’m sure it’s got something to do with 0 indexing or something - or I’ve somehow made it drop the element and then return the rest, instead of keeping the element which is the trigger?
Thanks,
m