Https://www.codecademy.com/paths/web-development/tracks/web-dev-js-arrays-loops-objects/modules/pjs-javascript-capstone/projects/lodash

In exercise https://www.codecademy.com/paths/web-development/tracks/web-dev-js-arrays-loops-objects/modules/pjs-javascript-capstone/projects/lodash

At drop-while method . related to findIndex() we pass two arguments to findIndex callback function method : element and index , Does findIndex pass two parameters to callback function within it , an element and index of element ? since I read at MDN findIndex only pass one argument to callback function .

dropWhile(array,predicate) {
function cb (element,index) {
return !predicate(element,index,array)
};
let droppedNumber = array.findIndex(cb);
let droppedArray = this.drop(array,droppedNumber);
return droppedArray;
}

That is because the findIndex method has optional input parameters.

1 Like