JavaScript reduce() method in 5 minutes! ♻️

  Рет қаралды 47,690

Bro Code

Bro Code

Күн бұрын

Пікірлер: 47
@BroCodez
@BroCodez Жыл бұрын
// .reduce() = reduce the elements of an array // to a single value // ----------- EXAMPLE 1 ----------- const prices = [5, 30, 10, 25, 15, 20]; const total = prices.reduce(sum); console.log(`$${total.toFixed(2)}`); function sum(accumulator, element){ return accumulator + element; } // ----------- EXAMPLE 2 ----------- const scores = [75, 50, 90, 80, 65, 95]; const maximum = scores.reduce(getMax); const minimum = scores.reduce(getMin); console.log(maximum); console.log(minimum); function getMax(accumulator, element){ return Math.max(accumulator, element); } function getMin(accumulator, element){ return Math.min(accumulator, element); }
@Blitz61wasd
@Blitz61wasd Жыл бұрын
Django course please
@Praeda19
@Praeda19 10 ай бұрын
Dude, thank you SO much, the way you've explained how the three data transformation array methods work, as well as the how the forEach loop works, is incredibly easy to understand. I've finally got my head around how the forEach loop works, and now JS is (ifnally) starting to click with me. Again, thank you, and all the best!!
@javohir1704
@javohir1704 8 ай бұрын
just restart
@RayhanAsif22
@RayhanAsif22 9 ай бұрын
Dude I've learned a lot from your videos !!
@Mochinori99
@Mochinori99 7 ай бұрын
This video is absolutely brilliant and so so clear. I love your videos. Thank you.
@pokerchannel6991
@pokerchannel6991 3 ай бұрын
.I have been trying to do everything with Array.from for example, I use it for summing let sum = 0.0 Array.from ( iter, (element, _) sum += element); see? no reduce. Reason? I don't know how to use reduce, yet. lol
@t.antonyjaneaustus3184
@t.antonyjaneaustus3184 4 ай бұрын
Very good explaination dude..its more help full to me
@piotrmazgaj
@piotrmazgaj 5 ай бұрын
This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.
@AdamGassouma
@AdamGassouma 7 ай бұрын
I did this : let username = ["Mr","Adam","Gassouma"]; let full = username.reduce(fullname); console.log(full); function fullname(previous,next){ return previous+" " + next; }
@zrotrasukha8733
@zrotrasukha8733 11 ай бұрын
Thank you brother, you helped me a lot, May god bless you !!
@JayFullSnackDev
@JayFullSnackDev 3 ай бұрын
Thank you for explaining it very well!
@MikeCode-iy9sb
@MikeCode-iy9sb 6 ай бұрын
very good explaination. thanksSoMuch~
@devl0ver666
@devl0ver666 8 ай бұрын
now i know why your channel name is bro code ................. :)
@vakyz5333
@vakyz5333 5 ай бұрын
I rarely comment. You're awesome!
@pexhay4690
@pexhay4690 Жыл бұрын
is there any difference between defining the callback that way and using arrow notation inside reduce like prices.reduce((accum, el) =>{...})
@ianfrye8988
@ianfrye8988 Жыл бұрын
For the most part no, just depends on if you’re going to reuse that function… when you get into the “this” keyword it does depending on the context
@pexhay4690
@pexhay4690 Жыл бұрын
@@ianfrye8988 thank you
@pokerchannel6991
@pokerchannel6991 3 ай бұрын
I have been trying to do everything with Array.from for example, I use it for summing let sum = 0.0 Array.from ( iter, (element, _) sum += element); see? no reduce. Reason? I don't know how to use reduce, yet. lol
@cyberblitz
@cyberblitz 9 ай бұрын
shame you didn't include the initial value parameter too. Otherwise, very educational.
@xxxharuxiao
@xxxharuxiao 5 ай бұрын
oh my god you saved my life thank you!!!!!
@constdev_
@constdev_ 6 ай бұрын
//Using Arrow Function: //Arrow Function is awesome :D const grades = [70, 65, 75, 89, 94]; const maximum = grades.reduce((previous, next) => Math.min(previous, next)); console.log(maximum);
@nomanbangtan4120
@nomanbangtan4120 Жыл бұрын
Bro you should do a project video.
@muhammetguloglu6268
@muhammetguloglu6268 6 ай бұрын
GOD BLESS YOU BRO!
@greengraphics5060
@greengraphics5060 Жыл бұрын
Do a node js video
@pini5076
@pini5076 11 ай бұрын
thank you so much!
@IfyOkoro-k3r
@IfyOkoro-k3r 4 ай бұрын
Thanks bro 🙏🏼
@islamabdelhakiim7258
@islamabdelhakiim7258 8 ай бұрын
thank you so much
@javohir1704
@javohir1704 8 ай бұрын
would be a way better if you added a initialValue parameter but thank you though
@neko62801
@neko62801 3 ай бұрын
What would i do without you my bro
@youthpost_34
@youthpost_34 4 ай бұрын
Thanks Brooo👊
@allhailalona
@allhailalona 7 ай бұрын
good video, but what about objects? u forgot those.
@magomihaly1741
@magomihaly1741 Жыл бұрын
You re the man thx bro
@TheRaviKumar44
@TheRaviKumar44 Ай бұрын
❤❤
@mahbubulislamridoy449
@mahbubulislamridoy449 3 ай бұрын
thanks sir
@kathikr9360
@kathikr9360 11 ай бұрын
thank you dude
@manitamao6564
@manitamao6564 10 ай бұрын
Thank u bro
@Blitz61wasd
@Blitz61wasd Жыл бұрын
django course please
@rukecodes
@rukecodes Жыл бұрын
Thanks bro!!!!!!
@satyanarayanparida5316
@satyanarayanparida5316 7 күн бұрын
let myArry = [1,2,3,4,5,6,7]; const sum = myArry.reduce((accumulator, currentvalue) => accumulator + currentvalue ); console.log(sum);
@sangi2971
@sangi2971 16 күн бұрын
.forEach () method , .map() method, .filter() method & . reduce () method = we are same bro ....😂
@yuvrajsingh-fz7hd
@yuvrajsingh-fz7hd 3 ай бұрын
best
@kathikr9360
@kathikr9360 9 ай бұрын
thanks again
@samridhshubham8109
@samridhshubham8109 4 ай бұрын
GOAT
@ianfrye8988
@ianfrye8988 Жыл бұрын
Also all other JavaScript higher order array methods can be created with reduce
JavaScript FUNCTION EXPRESSIONS in 7 minutes! 🐣
7:32
Bro Code
Рет қаралды 25 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 925 М.
JavaScript map() method in 7 minutes! 🗺️
7:01
Bro Code
Рет қаралды 55 М.
STOP Using Classes In JavaScript | Prime Reacts
14:02
ThePrimeTime
Рет қаралды 261 М.
The different types of JavaScript functions explained
14:47
Kevin Powell
Рет қаралды 47 М.
7 React Lessons I Wish I Knew Earlier
7:30
Code Bootcamp
Рет қаралды 76 М.
JavaScript Array Reduce
7:42
Programming with Mosh
Рет қаралды 343 М.
Learn JavaScript OBJECTS in 7 minutes! 🧍
7:01
Bro Code
Рет қаралды 82 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 911 М.
5 Real Life Examples of Array Reduce in JavaScript
12:47
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41