Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
95
rated 0 times [  98] [ 3]  / answers: 1 / hits: 56796  / 9 Years ago, wed, october 21, 2015, 12:00:00

I have this rows code:



_.each($scope.inspectionReviews, function (value, key) {
alert(status= + value.IsNormal + + name= + value.InspectionItemName);
if (!value.IsNormal) {
$scope.status = false;
return;
}
$scope.status = true;
})


At some point I want to stop looping but it seems that return not working.



How can I stop the loop?


More From » lodash

 Answers
12
return false;

Use this in a lodash each to break.


EDIT: I have seen the title changed to underscore. Is it underscore or lodash? As I pointed out above you can break an each in lodash but underscore I believe emulates forEach which natively doesn't provide that.


[#64649] Tuesday, October 20, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyemathewj

Total Points: 484
Total Questions: 107
Total Answers: 111

Location: Equatorial Guinea
Member since Sun, Feb 14, 2021
3 Years ago
;