5 Real Life Examples of Array Reduce in JavaScript

preview_player
Показать описание
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 👇

For your reference, check this out:

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:*

*Enrol Now - THE ULTIMATE JAVASCRIPT DOM CRASH COURSE* 👇

dcode-software
Автор

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.

nawal
Автор

You have a gift for explaining things clearly. I don't even understand English very well, but I understood you completely. Thank you

shamrai
Автор

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!

DaviddelaHarpe
Автор

Good to meet a fellow Australian programmer bro! You've got a new sub

dev_ression
Автор

It's very useful. I should practice it. Thank you.

srinivasaraoyp
Автор

I just found your channel, and as someone mentioned, good to see a nice Aussie instructor. Thanks 🙏

saman
Автор

Amazing. Thank you Dom.
You've got a Computer's mind! Am envious. Wish you could help me figure out a PHP challenge.

NedumEze
Автор

Always a great tutor: Subscription should be @1m+ for the great content you always deliver

DavidMwai-djup
Автор

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?

karlstenator
Автор

I recommend this lecture. thanks a lot👍👍👍

s유아마에브리띵
Автор

I'm a little confused with the house building example. Shouldn't it be return prev.cost + material.cost?

streamx
Автор

Nice one. Better used in complex methods.

rysmo
Автор

Array.reduce() is like array.filter() but on steroid. You can do a lot with it.

abubalo
Автор

You are really awesome bro thank you so much for your knowledge sharing keep go ahead 👌🏼👌🏼👌🏼😊😊

marimuthur