forEach vs Map in JavaScript?!

preview_player
Показать описание
Are you confused about the difference between the map and forEach methods in JavaScript? In this video, I explain the distinction between the two and provide examples of when to use each one. Join me as we dive into the world of array methods and learn how to manipulate data efficiently. Don't forget to subscribe for more informative content like this!
Are you trying to learn JavaScript?! You've come to the right place! Code Emily is all about JavaScript Tutorials, helping you get off the ground, tips for being a dev and more. Let's learn Javascript in 2023 together!

00:00 Introduction to forEach vs Map
00:16 forEach & map Refresh
00:28 Example 1: New Array of Cat names, forEach version
01:05 Why it's best to use map instead of forEach for this example
01:35 Example 1: New Array of Cat names, rewriting using map
01:55 Example 2: Array of cat names with only cats over the age of 7, forEach version
02:55 Example 2: Array of cat names with only cats over the age of 7, map/filter version
03:30 So...when would we use forEach?!
Рекомендации по теме
Комментарии
Автор

This explains it so well! So is there ever a time where I should use forEach instead of .map?

RoyalOcean