map, filter & reduce 🙏 Namaste JavaScript Ep. 19 🔥

preview_player
Показать описание
Map, filter & reduce Array functions are the most popular Higher-Order Functions in JavaScript. This episode covers map(), filter() & reduce() along with 11 detailed code examples from easy to tricky ones(The last example is the Best). You'll also find homework towards the end of this episode. ❤️

The only request is to watch this Episode of Namaste JavaScript with full attention. 🙏

00:00 - Introduction
01:39 - Example 1 - map
03:23 - Example 2 - map
04:01 - Example 3 - map
07:03 - Example 4 - filter
09:00 - Example 5 - filter
09:26 - Example 6 - filter
12:18 - Example 7 - reduce
18:41 - Example 8 - reduce
23:07 - Example 9 - tricky map()
25:40 - Example 10 - tricky reduce()
31:49 - Example 11 - Chaining map, filter & reduce
35:31 - Homework - Challenge
36:30 - Teaser of the Next Video
37:14 - Thank you for watching Namaste JavaScript 🙏

Support this web series, NOT BY MONEY, but by sharing it on social media.
please give a shoutout to Namaste JavaScript and help me reach more people. 🙏

I'll give my best to come up with great content and everything absolutely for free on YouTube. 😊

Cheers,
Akshay Saini

Would love to Stay Connected with you ❤️

#NamasteJS #AkshaySaini
Рекомендации по теме
Комментарии
Автор

Hi Aksahy, I am so grateful to you... You make my javascript concepts so clear that, I got offer from 5 companies and going to join a good company with 110% hike.
I really believe your content is worth payable. Thank you so much 🙌🙌🙌🙌
Keep educating and spreading love and knowledge. 🥳🥳🥳

ramdey
Автор

Things learned:
1. map method is used when we want transformation of whole array.
2. filter is used when we want to filter the arrar to obtain required value.
3. reduce is used when we want to reduce the array to single value eg (max, min, avg, sum, difference etc).
4. reduce passes two arguments one function(which includes accumulator and initial value as argument itself) and another initial value of accumulator.
5. Homework:
const output = user.reduce(function(acc, curr){
if (curr.age < 30){
acc.push(curr.firstName);
}
return acc;
}, [ ])

console.log(output);

jagrutsharma
Автор

Here is my solution:
const output = users.reduce(function(acc, curr){
if(curr.age < 30){
acc.push(curr.firstName); //if age of current user is < 30, push there firstName into the acc array
}
return acc;
}, [ ]); //initially, the acc will be an empty array

console.log(output);
Thanks Akshay for such a crystal clear explanation!!

harshitakohli
Автор

Hi Akshay,

I just finished your "Namaste JavaScript - series 1" course. I can't say how much confident I am in JavaScript now just because of you.
Thank you so much for making this amazing video series on JavaScript.

Homework solution:
const users = [
{ firstName: "Akshay", lastName: "Saini", age: 26 },
{ firstName: "Donald", lastName: "Trump", age: 75},
{ firstName: "Elon", lastName: "Must", age: 50},
{ firstName: "Deepika", lastName: "Padukone", age: 28}
];

const output = users.reduce(function(acc, curr) {
if (curr.age < 30) {
acc.push(curr.firstName);
}
return acc;
}, [ ] );
console.log(output);


P.S - from today onwards, I am naming you "The Amazing - Akshay Saini"

Regards,
Your Well-wisher and a learner

amodpatwa
Автор

Thank you for making me fall in love with Javascript again. Revisiting is always hard but with your videos, I am getting some new out from the same concepts.

lopamudrasahoo
Автор

I'm a Nigerian who has been struggling to understand these concepts with some of my friends. I love how you add jokes and giffs while teaching. You just earned 12 subscribers(I and my 11 friends)

ebukaavatar
Автор

Today I learnt 4 things from this video
1. Map function
2. Filter function
3. Reduce function
4. Deepika Padukon is still 26

Awesome video Akshay 👌👌👌

rahulprajapati
Автор

No words can express, how grateful I am for your explanation. you killed it! THANK YOU!

victortarroni
Автор

I freaking love your videos man.. u have no idea how much I'm hanging on to life because of u... you're not like the teacher who presents boring slides & reading from scripts, u speak from the heart.

I just love yr energy & enthusiasm.. u give me light at the end of the tunnel..

partspieces
Автор

Man your tutorials are so addictive, I don't want to study from other resources. You're like a good music band and we are fans that are waiting for new "songs". Please continue this awesome series 🙏🙏🙏

gtsin
Автор

✅After watching this video, do let me know in the comment, How was the video? I read all the comments, would love your feedback! ❤️

akshaymarch
Автор

I have been going crazy trying to figure out these concepts. Thank you for making them so Subbed.

multihyphenate
Автор

Thanks; one hour ago I only knew about filter() because I saw it on the FreeCodeCamp but hadn't gotten to the lesson yet. Now I have a good basic understanding and am going to use it to reformat previous projects.

TinyMaths
Автор

I complete the homework
const user = [
{ firstname: "Mohammad", lastname: "Noushad", age: 22 },
{ firstname: "Aniket", lastname: "Bhalla", age: 45 },
{ firstname: "Bidhi", lastname: "Chand", age: 21 },
{ firstname: "Saif", lastname: "Siddiqi", age: 67 },
];

const output = user.reduce((acc, current) => {

if(current.age < 30){
acc.push(current.firstname);
}

return acc;

}, []);

console.log(output);

mohammadnoushadsiddiqui
Автор

Brother - you are so natural in explaining these concepts! Big thanks 🙏

let belowFortyReduce = users.reduce((res, user) => {
if (user.age <= 40) {
res.push(user.fname)
}
return res
}, [])
console.log(belowFortyReduce)

akshaykrishna
Автор

// Code for the challenge given at 36:05
const outputlist = users.reduce((names, user) => {
if(user.age < 30){
names.push(user.firstname); //can also use names.unlist(user.firstname);
}
return names;
}, []);

pranavkuchimanchi
Автор

dude, you are a legend. I never saw anyone who explain a program the way you do. not just telling if you do this, this will happen, instead showing how it is happening. If you could upload the same way of teaching for other programs as well, it would be really amazing. I wouldn't mind to pay for such an golden content. also your smile really makes this course very enjoyable to watch. thankyou again

gratusrichard
Автор

Please cover the following topics:
1. async/await
2. Observables
3. Promise

ayushjain
Автор

After completing this series i can surely say that i have started to understand the JS concepts better...also the internal working thing was just top notch
The biggest takeaway from you that you always put on a smile on your face...and when you can teach us with enthusiasm...i can also learn smiling....
Thank you for this amazing series...
Waiting for Season 2

sameersahu
Автор

The following snippet will do the work :

users.reduce((acc, curr) => {
if(curr.age < 30)
acc.push(curr.firstName);

return acc;
}, []);

Thank You so much, Akshay for such great content !!

kartikgupta