I\'m learning JavaScript using W3C and I didn\'t find an answer to this question.
I\'m trying to make some manipulations on array elements which fulfill some conditi
You can use Array.prototype.find, wich does exactly what you want, returns the first element fullfilling the condition. Example:
> ([4, {a:7}, 7, {a:5, k:'r'}, 8]).find(o => o.a == 5) {a:5, k:'r'}