Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

break in 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;
  }
}
 
PREVIOUS NEXT
Tagged: #break #map #javascript
ADD COMMENT
Topic
Name
5+7 =