Can someone explain this solution to me? A friend helped me, but he just wrote it all out and didn't explain it. Now, I'm really confused :(
_.indexOf = function(array, target){
var result = -1;
_.each(array, function(item, index) {
if (item === target && result === -1) {
result = index;
}
});
return result;
};
return result;
};