JavaScript forEach vs. map - When To Use Each and Why
HTML-код
- Опубликовано: 7 сен 2024
- In today's video, let's compare the Array forEach method with map in JavaScript, and talk about when it's appropriate to use one or the other.
For your reference, check this out:
developer.mozi...
developer.mozi...
🏫 My Udemy Courses - www.udemy.com/...
🎨 Download my VS Code theme - marketplace.vi...
🐦 Find me on Twitter - / dcodeyt
💸 Support me on Patreon - / dcode
📰 Follow me on DEV Community - dev.to/dcodeyt
📹 Join this channel to get access to perks - / @dcode-software
If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
#dcode #javascript
Clear difference sited out when and where to use it
Bro you are full of wisdom. Cos Your contents are more than gold. Keep up the good work bro🇬🇭🇬🇭
Appreciate it man thanks for watching 🙏
Thank You sir!
Please what theme do you use in VSCode?
It's my theme. Search for "dcode" on VS Code Extensions Marketplace
i am old school guy, still iterating using old but good for :) But I personally feel that i would need modernize myself :)
Yeah just add "map" to your code if you're doing array transformations.
@@dcode-software OK, I'll do it.
Careful though, these are NOT the same things!
Whereas forEach and map perform a function on each item of your data, a for loop does what the name implies, looping over your data. Consequently, the behavior WILL be different, for instance when fetching data, etc.
U explain this stuff very very well
You should do udemy courses
Thank you. I actually do have a few Udemy courses but maybe I should do some more 😎
Your name Dom like Dominic or DOM like Document Object Model? Haha, jk, good stuff there, thanks!