Lodash dropWhile

Hi everybody
Ive been working on the lodash library dropWhile method. https://www.codecademy.com/paths/web-development/tracks/web-dev-js-arrays-loops-objects/modules/pjs-javascript-capstone/projects/lodash
I follow the instruction and everything works just fine.
dropWhile(array,predicate){
let dropNumber=array.findIndex(function(element,index){

        return!predicate(element,index,array);
    })
   
    const droppedArray=this.drop(array,dropNumber);
    return droppedArray;
}

i run a test myself by aadding following code
const users = [‘minh’,‘nghia’,‘dung’,‘ricky’];
console.log(_.dropWhile(users, function(str) { return str!=‘nghia’}));
I just dont understand why when i called the predicate function, i passed only 1 argument (str) to it, but i declared the predicate by passing to it 3 arguments( element,index,array)
Thank you

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.