5 Real Life Examples of Array Reduce in JavaScript

  Рет қаралды 8,679

dcode

dcode

Күн бұрын

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

Пікірлер: 30
@dcode-software
@dcode-software Жыл бұрын
*FULL VIDEO ON ARRAY REDUCE:* kzbin.info/www/bejne/aZ6qk617gbd1oa8 *Enrol Now - THE ULTIMATE JAVASCRIPT DOM CRASH COURSE* 👇 www.udemy.com/course/the-ultimate-javascript-dom-crash-course/?referralCode=DC343E5C8ED163F337E1
@user-shamrai
@user-shamrai Жыл бұрын
You have a gift for explaining things clearly. I don't even understand English very well, but I understood you completely. Thank you
@dev_ression
@dev_ression Жыл бұрын
Good to meet a fellow Australian programmer bro! You've got a new sub
@dcode-software
@dcode-software Жыл бұрын
Welcome 😊 thank you for subscribing. Good luck with your channel!
@user-hb7sl4hh1y
@user-hb7sl4hh1y 11 ай бұрын
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!
@saman6199
@saman6199 Жыл бұрын
I just found your channel, and as someone mentioned, good to see a nice Aussie instructor. Thanks 🙏
@nawal7721
@nawal7721 Жыл бұрын
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.
@NedumEze
@NedumEze Жыл бұрын
Amazing. Thank you Dom. You've got a Computer's mind! Am envious. Wish you could help me figure out a PHP challenge.
@user-tk2mx9vl2h
@user-tk2mx9vl2h Жыл бұрын
I recommend this lecture. thanks a lot👍👍👍
@allhailalona
@allhailalona 25 күн бұрын
great vidoe! thank you very much!
@parmjeetmishra2
@parmjeetmishra2 9 ай бұрын
Amazing .. Thank you
@marimuthur9456
@marimuthur9456 Жыл бұрын
You are really awesome bro thank you so much for your knowledge sharing keep go ahead 👌🏼👌🏼👌🏼😊😊
@DavidMwai-dj8up
@DavidMwai-dj8up Жыл бұрын
Always a great tutor: Subscription should be @1m+ for the great content you always deliver
@taofeeqomotolani2311
@taofeeqomotolani2311 Жыл бұрын
DOM, thanks man
@skolotoi4588
@skolotoi4588 Жыл бұрын
thanks, Dom!
@abubalo
@abubalo Жыл бұрын
Array.reduce() is like array.filter() but on steroid. You can do a lot with it.
@rysmo0
@rysmo0 11 ай бұрын
Nice one. Better used in complex methods.
@neilgregsoil1989
@neilgregsoil1989 Жыл бұрын
GOOD SIR!
@julioarruda8182
@julioarruda8182 Жыл бұрын
thanks again
@AidaHashemii
@AidaHashemii Ай бұрын
perfect
@streamx2
@streamx2 Жыл бұрын
I'm a little confused with the house building example. Shouldn't it be return prev.cost + material.cost?
@devax1t
@devax1t Жыл бұрын
i did learn something :)
@dcode-software
@dcode-software Жыл бұрын
Awesome 🔥
@karlstenator
@karlstenator Жыл бұрын
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?
@capslock3250
@capslock3250 8 ай бұрын
7:17 return prev[key] = value ?
@ali_mov_f
@ali_mov_f Жыл бұрын
first
@jordanski5421
@jordanski5421 Жыл бұрын
same
@Leron_T
@Leron_T Жыл бұрын
@@jordanski5421 same
@squarerootof2
@squarerootof2 Жыл бұрын
Congrats. You'll all get a lame, dummy & cringe award to add to your collections.
@suelingsusu1339
@suelingsusu1339 Жыл бұрын
👌👌👌👍👍👍👍🙏🙏🙏🙏🖖🖖🖖🖖🌹🌹🌹🌹
3+ Ways to Write Clean Code in JavaScript
13:33
dcode
Рет қаралды 9 М.
Дибала против вратаря Легенды
00:33
Mr. Oleynik
Рет қаралды 4 МЛН
Survival skills: A great idea with duct tape #survival #lifehacks #camping
00:27
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 58 МЛН
Reduce: 10 Different Examples. JavaScript Fundamentals.
26:57
Leigh Halliday
Рет қаралды 28 М.
Another 5 Must Know JavaScript Array Methods
14:24
dcode
Рет қаралды 4,2 М.
Learn JavaScript DOM Traversal In 15 Minutes
14:44
Web Dev Simplified
Рет қаралды 220 М.
Maps vs. Objects in JavaScript - What's the Difference?
11:48
Reduce это просто. JavaScript
17:11
WebDev с нуля. Канал Алекса Лущенко
Рет қаралды 60 М.
Common JavaScript Mistakes and How to Avoid Them
18:48
dcode
Рет қаралды 6 М.
Solving a JavaScript Array Reduce Interview Question
11:27
Wes Bos
Рет қаралды 22 М.
Map, Filter & Reduce EXPLAINED in JavaScript - It's EASY!
11:23