Find
You can use the find
function on a collection to return the first element that matches a condition.
const x = [2, 5, 8, 3, 10, 12]
const y = x.find(n => n > 7) // = 8
You can use the find
function on a collection to return the first element that matches a condition.
const x = [2, 5, 8, 3, 10, 12]
const y = x.find(n => n > 7) // = 8