var users = [
{ 'user': 'barney', 'active': false },
{ 'user': 'john', 'active': false },
{ 'user': 'fred', 'active':true },
{ 'user': 'pebbles', 'active': true }
];
let drop = (array, n=1) => {
return array.slice(n)
}
const dropWhile = (array, predicate) => {
const cb = (element, index) =>
{console.log(element,index)
return !predicate(element, index, array);
};
let dropNumber = array.findIndex(cb);
console.log(dropNumber)
let droppedArray = drop(array, dropNumber);
return droppedArray;
}
dropWhile(users, function(o) { return !o.active; });
I have problems understanding this. Could someone please explain me how this work? Even call to dropWhile with this return is confusing me. I understood every other method we did in lodash exercise but this is really troubling me