map() is a very important array method to know. Call it on an array, and it will map over each element in the array, and call a function on it. It will then produce a new array as a result. The result array may have nothing or very little to do with the original array. All it says, in essence is, "Do something for each value in the array and place a result in the same index of a new array." This pattern allows you to write an operation that uses your array, while keeping it immutable. Instead of modifying the original array, a new array is created. This is a useful part of functional programming, a type of programming by which we call functions on data and create new modified copies, without changing the state of the original objects and arrays. I find that map() is very useful when changing the format of data. Often, I will retrieve data from a database or from some other service, but it might be in the wrong format. Calling map() on it, allows me to quickly, and cleanly, format it for the frontend of a website or app, or to prepared it to be served by an API.
Visit the website you can read more articles, find more videos, and sign up to the newsletter.
https://mackleystudios.com/
Looking for a remote freelancer?
Send me an email at contact@mackleystudios.com
On this page of the site you can watch the video online map() - JavaScript Array Methods with a duration of hours minute second in good quality, which was uploaded by the user Mackley Studios 12 January 2020, share the link with friends and acquaintances, this video has already been watched 13 times on youtube and it was liked by 1 viewers. Enjoy your viewing!