How to break _.each() loop? Tried with _.every(), it is looping through the data only once.
Sample code:
_.each([1,2,3,4,5],function(num){
if(num < 3)
console.log(num)
else{
console.log(num);
return false;
}
});
Output: 1 2 3 4 5
_.every([1,2,3,4,5],function(num){
if(num < 3)
console.log(num)
else{
console.log(num);
return false;
}
});
Output: 1 false