DEV Community

Cover image for Three methods that you should know - JavaScript
Alex Principe
Alex Principe

Posted on

Three methods that you should know - JavaScript

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.
findJS

filter()

The filter() method creates a new array with all elements that pass the test implemented by the provided function.
filterJS

reduce()

The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in single output value.

reducev2

References

Top comments (2)

Collapse
 
ifkas profile image
Ivo Culic • Edited

Hi there, last screenshot you have a typo?
const nameQuantity = name.reduce should be const nameQuantity = names.reduce you always reduce the array.

Collapse
 
arvprincipe profile image
Alex Principe

You're right! it was my mistake. Thank you @ivo Culic

I've already corrected it.