Skip to main content

Posts

Showing posts from January, 2022

Introduction to map method in Javascript

map is one of the most used, popular array methods in Javascript. It can also be referred as higher order function. Higher order function is a function which returns function or which accepts other functions as arguments.Let's understand about map function many times you need to take an array and modify it according to your needs and you can easily achieve this with help of map method. Syntax of map method                  map method accepts a callback function which is executed on each of the element of the array. Callback function can also be written using arrow syntax callback function accepts following arguments element -  It is the current element  being processed in the iteration  Index -  It is the index of current element being processed and it is    optional array - array on which the map method was called and it is  optional    let's understand map method with an example  consider...