Javascript Array Iterative Methods (Part 1): Map

preview_player
Показать описание
[ * ] Read this, it's important

You see I edited the person variable that was passed to the callback function? I set the property weightCategory but if I do this, it will also modify the objects in the original array because objects are passed by reference in javascript. The objective of the map and filter methods are to create new arrays, not to modify the original so, we could've created a variable with an object that only consisted of the name and the weight category of the person, then return it.

-------------------------------------------------------------

[ * ] Possible questions by the viewers

OS: Elementary OS (Ubuntu-based Linux distribution)
Capture software: Kazam
Documentation Software: Zeal for Win/Linux, Dash for Mac
Web-browser: Vivaldi (chromium-based)
New-tab extension: Momentum Dash
OS Icon Theme: Numix Circle

---------------------------------------------------------------

[ * ] Relevant links:

Рекомендации по теме