Tuesday, April 10, 2018

.find in JavaScript

This has this example which returns the first match for a condition, in this case the number 12.

var array1 = [5, 12, 8, 130, 44];
var found = array1.find(function(element) {
   return element > 10;
});

No comments:

Post a Comment