Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

break out of map javascript

That's not possible using the built-in Array.prototype.map. 
However, you could use a simple for-loop instead, if you do not intend to map any values:
var hasValueLessThanTen = false;
for (var i = 0; i < myArray.length; i++) {
  if (myArray[i] < 10) {
    hasValueLessThanTen = true;
    break;
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #break #map #javascript
ADD COMMENT
Topic
Name
3+3 =