페이지 정보

작성자라니 조회 8회 작성일 2020-08-08 18:56:42 댓글 0


JavaScript Array Reduce

JavaScript Array Reduce

Get the COMPLETE course (83% OFF - LIMITED TIME ONLY):

Subscribe for more videos:

Want to learn more from me? Check out my blog and courses:
AnEmptyBox : Beautiful!
venkata sai injarapu : Mosh you are a Bosh
Shivaram Muthukumaraswamy : Thank you so much
Mike Hurtado : If is an array of objects?
kudafoolhu : Thank you. Better than any video out there.
Agata Szczypta : nice and clear
Wattana Leas : This is nice but it'd be great if there was something on how to use reduce when making new objects/arrays
Sukhjinder Singh : Very nicely explained !
Muhammad sultanul arafin : Wow! Explained in a super easy way. Thank you.
Jay G. : Dude is good

16.7: Array Functions: reduce() - Topics of JavaScript/ES6

In this video, I cover the JavaScript array function reduce().

Next Video:

MDN's Array Documentation:

The Coding Train website:
Support this channel on Patreon:
To buy Coding Train merchandise:
Book recommendations:

For an Introduction to Programming:
For More Coding Challenges:

Code of Conduct:
Hasnain Ali : if (MyTeachers===you) {
let myself = "Top in Every Class" ;
Arindam : thank you :)
banhquychamsua : thanks for your great work <3, it took me days to understand reduce() method
Muzaffer cıkay : Why use reduce after see the following output?

let numbers = []

for(let i = 0; i<1000000; i++){
numbers[i] = i

let even_number_via_for = []
let for_total = 0
let filter_reduce_map_total = 0
let reduce_total = 0

function viafor_total(){

let for_total = 0
for(let i = 0; i < numbers.length; i++){

if(numbers[i]%2 == 0){

for_total += numbers[i]**2 //like firstly, run filter then map nad then reduce


return for_total

for_total = viafor_total()
console.log(`for_total: ${for_total}`)


filter_reduce_map_total = numbers.filter(a => a%2 == 0).map(a => a**2).reduce((total, current) => total + current)


console.log(`filter_reduce_map total: ${filter_reduce_map_total}`)


reduce_total = numbers.reduce( function(total, current){

if(current%2 == 0){

total += current**2

return total



console.log(`reduce: ${reduce_total}`)



for: 7.088ms
for_total: 166666166666505600
filter_reduce_map: 132.016ms
filter_reduce_map total: 166666166666505600
reduce: 24.471ms
reduce: 166666166666505600

Jiro Ricaro : I love this. You're really entertaining and I'm learning so much!!!!
Antanas Andrulis : Good. Just missing some examples where they can be useful.
rameen alikhani : Daniel, the crazy uncle that everyone needs!
Josh Randall : What a solid explanation. Thank you! Love your videos :D!
Carlos José Rivera : This guy is smooth.
Amal Gregri : it was challenging for me to understand reduce() you are my favorite teacher ever :D I enjoyed your video and I actually learned, thanks man

Reduce, Reuse and Recycle, to enjoy a better life | Educational Video for Kids.

The three Rs

Hello I am the Earth, yup the very planet you live on. There are three words which start with the letter R which I love. They are: Reduce, reuse and recycle. Do you know why I love them so much? Because they are almost magical words. Together they can make all living things as well as myself be happier. I said that they are “almost” magical because without your help it won't work, they need all of you children in order to do the trick. Each and every one of you are the real 3Rs magicians, those three words which can change the world. Do you want to know how? Yes? Well let's find out.

The first R is for reduce. If you think about it, there are many things you don’t need. When you go to the supermarket, I am sure you could take your own canvas bags instead of using disposable ones given to you. This way you will be reducing the amount of plastic which is very contaminating. And I am sure that you don’t need to print out so many documents or photos, nor leave the lights, television or computer on when you are not using them. If you remember this, you will be reducing the amount of paper being used as well as energy, and in turn will be helping reduce the contamination. And these are just a few examples. I am sure you can think of many more different ways to reduce what you are using or creating unnecessary waste. The following question will help you with this task: Do I really need this or is this just a whim?
The second R is for recycling. Now it is easier than ever to recycle things we don’t need any more so that they can be reused. Near your home you can find places, like the recycling station and containers for cans, plastic, paper or organic waste. They each have their specific colors to make them easier. By using them, you will avoid contaminating nature, the rivers and seas as well as the atmosphere, which is the air we breathe.

And finally we have the third R, which refers to reuse. How many things do you think we can reuse again and again instead of throwing them away? Let´s see…a piece of paper that has only one side printed on it, a carton box, a plastic bottle…you think now. With just a bit of imagination, I am sure you will come up with many more exciting and fun new uses for them.
And remember: if you apply the 3Rs rule, you will make me a much cleaner planet, with less contamination and where we all can enjoy a better life.

Because as you know…children can make the world of difference.




등록된 댓글이 없습니다.

전체 952건 1 페이지
게시물 검색
Copyright © All rights reserved.  Contact :