5 Real Life Examples of Array Reduce in JavaScript
ฝัง
- เผยแพร่เมื่อ 22 ก.ค. 2024
- A lot of guides online (including my own) will show the "sum of all numbers" example when explaining how the array reduce method works.
In this video, I'll take you through 5 unique and applicable examples of using the reduce method in JavaScript.
Chapters:
0:00 Intro
0:40 Find the Sum of Numbers
3:01 Find the Sum of Numbers in an Object
4:49 Convert a 2D Array into an Object
7:31 Find the Max Value of an Array of Objects
9:47 Find the Number of Occurrences of Each Element
12:21 Outro
THE ULTIMATE JAVASCRIPT DOM CRASH COURSE 👇
www.udemy.com/course/the-ulti...
For your reference, check this out:
developer.mozilla.org/en-US/d...
🏫 My Udemy Courses - www.udemy.com/user/domenic-co...
🎨 Download my VS Code theme - marketplace.visualstudio.com/...
💜 Join my Discord Server - / discord
🐦 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
*FULL VIDEO ON ARRAY REDUCE:*
th-cam.com/video/3mGbzELRBkM/w-d-xo.html
*Enrol Now - THE ULTIMATE JAVASCRIPT DOM CRASH COURSE* 👇
www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1
You have a gift for explaining things clearly. I don't even understand English very well, but I understood you completely. Thank you
dude! killer video. You're right, most reduce method tutorials focus on one scenario, adding up all the element of an array. Your video was far more comprehensive to real world scenarios. Very well explained too!
Good to meet a fellow Australian programmer bro! You've got a new sub
Welcome 😊 thank you for subscribing. Good luck with your channel!
I just found your channel, and as someone mentioned, good to see a nice Aussie instructor. Thanks 🙏
how is prev[color] returning the color name but then (prev[color] || 0) + 1 is return a number. Also if I just console.log(prev[color]) it outputs numbers but i though I should output {green}. I'm well confused.
Amazing .. Thank you
great vidoe! thank you very much!
I recommend this lecture. thanks a lot👍👍👍
Amazing. Thank you Dom.
You've got a Computer's mind! Am envious. Wish you could help me figure out a PHP challenge.
thanks, Dom!
DOM, thanks man
Always a great tutor: Subscription should be @1m+ for the great content you always deliver
You are really awesome bro thank you so much for your knowledge sharing keep go ahead 👌🏼👌🏼👌🏼😊😊
thanks again
GOOD SIR!
perfect
Nice one. Better used in complex methods.
i did learn something :)
Awesome 🔥
I'm a little confused with the house building example. Shouldn't it be return prev.cost + material.cost?
At 9:35 - if I try to return either the object, or the name of the highest salary object - I get an undefined return. Could you post the solution please?
Array.reduce() is like array.filter() but on steroid. You can do a lot with it.
7:17 return prev[key] = value ?
👌👌👌👍👍👍👍🙏🙏🙏🙏🖖🖖🖖🖖🌹🌹🌹🌹
first
same
@@jordanski5421 same
Congrats. You'll all get a lame, dummy & cringe award to add to your collections.