If you are a web developer, there are three useful methods that you should know about.
find()
The find() method returns the value of the first element in the provided array that satisfies the provided testing function.
filter()
The filter() method creates a new array with all elements that pass the test implemented by the provided function.
reduce()
The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in single output value.
Top comments (2)
Hi there, last screenshot you have a typo?
const nameQuantity = name.reduce should be const nameQuantity = names.reduce you always reduce the array.
You're right! it was my mistake. Thank you @ivo Culic
I've already corrected it.