I’m pretty sure that most of us haven’t benefited from some of these amazing Javascript Array functions we’re going to discuss here. These functions are very useful and will definitely speed up your development.
We will use the following JSON data for this tutorial. It is an array of product information, including title, category, price, etc.
Take a look at this data before proceeding to the blog. We’re going to perform different operations on this data and learn about some amazing Array functions.
The code snippets are self-explanatory. If you have any questions or suggestions,please let me know in the comments.
Bonus trick in the end 😉
Before getting into the Array functions, I’d like to introduce you to Arrow functions (also called “fat arrow” functions). Arrow functions allow us to write shorter functions
Below is a normal JS function
Now let's re-write above Fn using Arrow function
Both the codes produces following output => “Hello Professor”
All of the Array Functions we are going to discuss today takes a callback function as input and we’ll be writing those callbacks using arrow functions.
Let’s get our hands dirty.
.map()
Goal: get list of all product titles