Learn JavaScript Array Reduce In 10 Minutes

JavaScript Simplified Course: javascriptsimplified.com
By far the most difficult JavaScript array method to learn is the reduce method. It combines together many concepts from other array methods, but also acts in a completely different way. In this video I will be going in depth over everything you need to know about this method so you can start using it in your next project.
📚 Materials/References:
JavaScript Simplified Course: javascriptsimplified.com
Reduce Array Method Article: blog.webdevsimplified.com/202...
🌎 Find Me Here:
My Blog: blog.webdevsimplified.com
My Courses: courses.webdevsimplified.com
Patreon: / webdevsimplified
Twitter: / devsimplified
Discord: / discord
GitHub: github.com/WebDevSimplified
CodePen: codepen.io/WebDevSimplified
⏱️ Timestamps:
00:00 - Introduction
00:45 - Basics of reduce
04:50 - Second reduce example
07:17 - Advanced reduce features
#ReduceArray #WDS #JavaScript

Пікірлер: 387

  • @rosseaton990
    @rosseaton990 Жыл бұрын

    This was the most simple and straight forward example of reduce I've seen. Thank you!

  • @higherpurpose1212
    @higherpurpose1212 Жыл бұрын

    What I love about Kyle's teaching style and videos is he first writes the code in another familiar way then converts it into the topic he's about to discuss. Whenever I want to learn something quickly and clearly without fuzz, like Recursion, his videos are my go-to learning material! He breaks it down step-by-step full of detailed explanations. Amazing!

  • @Vibestr
    @Vibestr2 жыл бұрын

    Another good reason to set the second parameter on the reduce is if you are totaling price on an object (like in your example) and you didn't set this parameter to 0, then total would represent the object (the first item in the array) and your code would error out. Thank you for this video Kyle.

  • @kelseymovies
    @kelseymovies2 жыл бұрын

    Thank you for this! I just took a whole course about it and got even more confused. Your video broke it down to a point where it clicks.

  • @ademlayes9116
    @ademlayes9116 Жыл бұрын

    I've watched this video twice, once before ~5 months and now after forgetting what "reduce" does... and im so thankful every time! Thank you!

  • @MrGodman1981
    @MrGodman19812 жыл бұрын

    Last week I was struggling with aggregate of object attributes in an array of objects due to the missing intiial value of 0 and I learned it the hard way. Also I had the groupby use case well. Thanks for simplying groupBy.

  • @MrLiquitorleaveit
    @MrLiquitorleaveit2 жыл бұрын

    Incredibly well explained! Thanks so much! 🙏

  • @NaroTaro
    @NaroTaro Жыл бұрын

    I've been stuck on understanding reduce for 2 days now. This video cleared everything up. Thanks!

  • @pugazhonline
    @pugazhonline2 жыл бұрын

    I have used reduce() many times. but clearly understand now. Thanks Kyle.

  • @elie8181
    @elie81812 жыл бұрын

    very good explanation of the reduce method, it is clear and simple. I'm a french developper in training and I understood everything, thank you and good continuation for your KZread channel

  • @alirezashahmoradi7648
    @alirezashahmoradi76482 жыл бұрын

    I cant believe how you made it that simple. Thank you!!

  • @kp2947
    @kp29472 жыл бұрын

    Man, you helped me solve a problem that's been kicking my butt for a LONG time. THANK YOU!

  • @SiddhantaPaul80
    @SiddhantaPaul80 Жыл бұрын

    That's an impressive straight forward explanation! Really liked the analogy with forEach Loop.

  • @VenkateshMogili
    @VenkateshMogili2 жыл бұрын

    Thank you kyle, got more clarity on Reduce method now❤😊😊👍

  • @scratchercatcher6760
    @scratchercatcher67602 жыл бұрын

    Thank you VERY MUCH! All CLEAR NOW FOR ME and you made video without any extra "bloggers show off". My like to you and subscription.

  • @YannMetalhead
    @YannMetalhead2 жыл бұрын

    Simple and direct, great explanation.

  • @Kae201
    @Kae2012 жыл бұрын

    This video was really helpful and clear. Thank you!

  • @shvideo1
    @shvideo1 Жыл бұрын

    Perfect content coverage on reduce. You are amazing! Thank you for sharing.

  • @EdisonSeas
    @EdisonSeas10 ай бұрын

    Very well explained, crystal clear. Thanks for this content!

  • @MiSt3300
    @MiSt33002 жыл бұрын

    This is a perfect explanation, thank you!

  • @johnjoyce
    @johnjoyce2 жыл бұрын

    best explanation of reduce in javascript that i have ever seen. be cautious saying amunnuh when you mean “I’m going to”. that can be difficult for non native listeners

  • @_boza
    @_boza2 жыл бұрын

    I think you said the best definition of reduce ever. "Reduce, all it does. It takes array of values whatever that is and reduces it down to one single value"

  • @beepybeepy4903
    @beepybeepy4903 Жыл бұрын

    Thank you so much! This is so much clearer than other tutorails using acc, cur….

  • @snansahmarov1524
    @snansahmarov15242 жыл бұрын

    Thank you Kyle. You are great !

  • @iooosef6006
    @iooosef60062 жыл бұрын

    I'm looking forward for more videos about array, string, and object methods. Your explanations are so great.

  • @athillas460

    @athillas460

    2 жыл бұрын

    same

  • @InsertYourself1
    @InsertYourself1 Жыл бұрын

    10 minutes of this is so much better than 1,000 hours of understanding the docs

  • @elkhanhamet2561
    @elkhanhamet2561 Жыл бұрын

    Amazing explanation. Thank you Kyle!!!🙂

  • @nabilelidrissi8541
    @nabilelidrissi8541 Жыл бұрын

    I've watched a fair few videos on reduce, but you have explained this wayyyy better.

  • @themanshaper
    @themanshaper Жыл бұрын

    Dude your explanations are so good. Thank you!

  • @tanvirhasanmonir1627
    @tanvirhasanmonir1627 Жыл бұрын

    Thanks Kyle for your simplified explanation with useful example

  • @cfhall54
    @cfhall542 жыл бұрын

    Much appreciated! This can definitely be a time saver

  • @mr__info___
    @mr__info___ Жыл бұрын

    You truly simplify the web. thank you!

  • @simple8810
    @simple88102 жыл бұрын

    reduce is like different and complex from other array methods,but you made clear that for us thanks

  • @mayowasunusi9161
    @mayowasunusi91615 ай бұрын

    Thank you Kyle, I saw .reduce in a TS tutorial, i had no idea how to do it, your video was straightforward

  • @dasten123
    @dasten1232 жыл бұрын

    I like the reduce function. But many people use it on occasions where a simple `forEach` loop would be more appropriate, and that gives the `reduce` a bad reputation, because it seems to make things unnecessarily complicated. I think you should always be aware of that whenever you are about to use it.

  • @rajat4002
    @rajat40022 жыл бұрын

    I was looking for resources to learn about `reduce` method. Your video came in as a rescue Kyle.. 😍 You are a saviour!!

  • @Scrappycoco
    @Scrappycoco2 жыл бұрын

    Thank you for your videos!

  • @vinicius2336SP
    @vinicius2336SP2 жыл бұрын

    Dude... you're amazing! Thanks a lot! You're so much better than my teacher LOL Thanks for your content! I'll be buying your course soon. :) Have a nice day!

  • @dr__ey
    @dr__ey Жыл бұрын

    thanks so much for this explanation!!! it really helped

  • @tijanisylla1348
    @tijanisylla13482 жыл бұрын

    Im always learning from Kyle ! This is an amazing !!!!

  • @Sun-gk8fc
    @Sun-gk8fc Жыл бұрын

    7 the video on reduce in the last 40 mins and this is as simple as you can get...superb. A like and a subscribe from me.

  • @galihhad
    @galihhad8 ай бұрын

    Thank you, I understand it much better now!

  • @pcchamikara
    @pcchamikara Жыл бұрын

    you REDUCED my effort of understanding the "reduce" function. 👌

  • @donotlook6048
    @donotlook60482 жыл бұрын

    This guy really uploaded this video 2 weeks ago and today I needed to use reduce and didn't know it worked, now i do thanks man. Whenever I need to understand something new I just type the concept + webdevsimplified and watch ur video lol

  • @TheDanthelion
    @TheDanthelion Жыл бұрын

    While I understood how reduce worked, I didn't quite get why I kept hearing how powerful it was - your object example made it very clear in a short amount of time!

  • @codingwithkenny6492
    @codingwithkenny64922 жыл бұрын

    You are awesome, Kyle! Your videos have helped me learn so much about Javascript👍

  • @stylesg7818
    @stylesg78182 жыл бұрын

    Thank you so much! It's make so much sense now.

  • @xiampiii
    @xiampiii Жыл бұрын

    Thank you for a great and easy to understand explanation

  • @travel2react567
    @travel2react5672 жыл бұрын

    Thanks a lot for such a detailed video.

  • @hayfachouchene1285
    @hayfachouchene12852 жыл бұрын

    amazing explanation ! good job

  • @fatimazboujrar
    @fatimazboujrar6 ай бұрын

    thank you so much , you've covered everything 🤩

  • @darklord8684
    @darklord8684 Жыл бұрын

    after your explanation this is my fav method

  • @filipcza2
    @filipcza2 Жыл бұрын

    Thanks man! Been hating the tasks which force you to use reduce so far.. feels like you randomly try until it somehow works. I really don't get why this feels so awkward to use or understand but your examples were extremely clear and helpful. Perhaps now I can stop dreading the reduce method. 😅

  • @Unknown-so7qv
    @Unknown-so7qv Жыл бұрын

    Nice video bro, i finally have understood how to filter objects by a key with reduce thx man .

  • @chandrachurmukherjeejucse5816
    @chandrachurmukherjeejucse5816 Жыл бұрын

    As always a great lecture. Thanks a lot

  • @ngyang5113
    @ngyang51132 жыл бұрын

    u are amazing, all ur video is concise and easy to understand

  • @The1stKing
    @The1stKing2 жыл бұрын

    Haha, just what i needed. 😆 I literally just youtube-ed how to use reduce function.

  • @bartoszsowa5140
    @bartoszsowa51402 жыл бұрын

    you made it clear, thank you

  • @loumeroj
    @loumeroj2 жыл бұрын

    I'm at least watching the ads cause this guy explained reduce briefly and concisely :) and nice hair btw

  • @2pacgamer
    @2pacgamer2 ай бұрын

    very clear, thx for this one !!

  • @andzisimabaso5622
    @andzisimabaso56222 жыл бұрын

    This is just awesome! Finally, I get it.

  • @jeremey__
    @jeremey__ Жыл бұрын

    thanks, good explanation!

  • @musaamuhsen
    @musaamuhsen2 жыл бұрын

    Dude this just saved me. Thanks!

  • @JuanPablodelaTorre
    @JuanPablodelaTorre2 жыл бұрын

    I love the _reduce_ method. I use it for everything. I would brush my teeth with it if I could. If you ever _map-filter-map-find_ anything, do everyone a solid and just use _reduce._

  • @encapsule2220
    @encapsule2220 Жыл бұрын

    best explanation. my scalp is starting to regrow hair follicles thanks to u

  • @Ranjithkumar-ll5rb
    @Ranjithkumar-ll5rb Жыл бұрын

    you are my life saver! Thank you🙏

  • @meysamrezania54
    @meysamrezania542 жыл бұрын

    That was pretty cool explanation

  • @namlulu7230
    @namlulu72302 жыл бұрын

    고마워요! Thank you so much!

  • @pechupechaairukkattum6986
    @pechupechaairukkattum6986 Жыл бұрын

    simply awesome. thanks a lot

  • @JamesJon1187
    @JamesJon1187 Жыл бұрын

    4:12

  • @jssecrets
    @jssecrets2 жыл бұрын

    Thank you Kyle!

  • @vivekmodi3165
    @vivekmodi31659 ай бұрын

    The concept of reduce method is very well explained because it was difficult to understand the concept of this in the documentation. Thanks.

  • @eugene4296
    @eugene42963 ай бұрын

    This is amazing, and really helpful. I have immediately subscribed. And I think I love you sir. :)

  • @odilanmaevidence9545
    @odilanmaevidence9545 Жыл бұрын

    All i gotta say is Thank you mate, you're awesome!

  • @ramonmaximiliano3557
    @ramonmaximiliano35572 жыл бұрын

    Excellent video!

  • @pawandabi6367
    @pawandabi63672 жыл бұрын

    Good explanation Keep posting 💥

  • @johnadriandodge
    @johnadriandodge9 ай бұрын

    Shalom Mr. K, outstanding explanation! Thank you Shalom

  • @kunalmaloo8806
    @kunalmaloo88062 ай бұрын

    best explaination i used for loop each time but now onwards i am shifting to reduce

  • @yahelsasson
    @yahelsasson10 ай бұрын

    Awesome 🎉 thank you

  • @nirmesh44
    @nirmesh442 жыл бұрын

    exactly what i was looking for

  • @re.liable
    @re.liable Жыл бұрын

    I feel lucky that I was able to intuitively understand reduce for the most part. Except that second parameter. That tripped me up hard quite a bit.

  • @UmarAlFarooq
    @UmarAlFarooq2 жыл бұрын

    Awesome video!

  • @freudinsky
    @freudinsky10 ай бұрын

    LOL - after googling for HOURS(!!!) I finally got it - after just 3min into this video. Damn good explanation! Thank you sooo fkn much!!!

  • @lamargtv2572
    @lamargtv25722 жыл бұрын

    Diamond explanation, thanks

  • @learnsmart1812
    @learnsmart18122 жыл бұрын

    Thanks Kyle. Cool one

  • @Raubritterr222
    @Raubritterr2222 жыл бұрын

    Kyle, I love your videos! You are a great teacher and a superb developer!

  • @MarianussPL
    @MarianussPL2 жыл бұрын

    Great explenation

  • @johnwellgroup
    @johnwellgroup7 ай бұрын

    Thank you very muh for really breaking this topi. you are the best

  • @Zen-lz1hc
    @Zen-lz1hc Жыл бұрын

    LIKE :) Thank you for publishing this video. Really clear and friendly introduction to reduce() method!

  • @princecharles-amachree7329
    @princecharles-amachree73292 жыл бұрын

    Was legit looking for this today and my man ends up making a video on it. Coincidence? I think not

  • @yusker1994
    @yusker19942 жыл бұрын

    Thank you!

  • @mayankchavda6839
    @mayankchavda68392 жыл бұрын

    thank you so much your this vdo helps me a lot thank you so much

  • @SquaredIndex
    @SquaredIndex Жыл бұрын

    Good explanation Kyle! I think the second example should use undefined rather than null, then you can use strictly equals like so: if (groupedPeople[age] === undefined) groupedPeople[age] = []

  • @caterpilar

    @caterpilar

    Жыл бұрын

    you can go even further using `.hasOwnProperty()` to check object key

  • @jollyjoker6340

    @jollyjoker6340

    11 ай бұрын

    null and undefined are falsy so if(groupedPeople[age]) is enough

  • @j8ge
    @j8ge2 жыл бұрын

    clear and helpful

  • @nazeefpeerzade6378
    @nazeefpeerzade63782 жыл бұрын

    thank u soo much kyle

  • @mattplaygamez
    @mattplaygamez2 жыл бұрын

    You deserve more subscribers

  • @tomgu1809
    @tomgu18092 жыл бұрын

    reduce doesn't only apply for total, total from your addition statement. If you change + to -. it will deduct from initial value by each item .

  • @shaderone07
    @shaderone072 жыл бұрын

    Wow so close to 600k. Awesome

  • @avi12
    @avi122 жыл бұрын

    The reduce method is a double-edged sword, as explained by a Google Developers video: kzread.info/dash/bejne/o5V7zLVwXdS9qso.html On the one hand, the reduce method is handy On the other hand, it might reduce the readability (see the pun?)

  • @parahumanoid

    @parahumanoid

    2 жыл бұрын

    I wonder if we should name the object "vague" and the parameter -- "readability": const x = vague.reduce((overall, readability)=>{ ....}, 0)

  • @hathumkittitus9663
    @hathumkittitus96632 жыл бұрын

    Thanks, I never set seccond parameter but from now I will alway set it 😍🥰

  • @hathumkittitus9663

    @hathumkittitus9663

    2 жыл бұрын

    I mean that zero