dropWhile Lodash Library

Hi everybody
I am doing the lodash library project and i have a question about the dropWhile method.
why can i call the anonymous callback function with the element and index arguments, they are not declared before so how do the function know what are its values?

let dropnumber = array.findIndex(function(**element**,**index**)
    { return !predicate(element,index,array) });

hope i wrote the question clear enough.

Hey Dorit,

You are merely building the method. Running the test through the node will call for a test file which contains the parameters to test the method :wink: .

Hope this provides an answer.

i thought that the only method that the test file is calling is the dropwhile…

The element and index are parameters used in the Javascript method findIndex.
You don’t have to pass these yourself since it is a library method that is chained to array in the code.

More info here. And yes it is somewhat complex, but it is being explained.