map, filter & reduce π Namaste JavaScript Ep. 19 π₯
844,260
Published 2021-07-20
The only request is to watch this Episode of Namaste JavaScript with full attention. π
My tech gear I use every day - google.peek.link/2pba
00:00 - Introduction
00:40 - Array.map() function in JavaScript
01:39 - Example 1 - map
03:23 - Example 2 - map
04:01 - Example 3 - map
06:43 - Array.filter() function in JavaScript
07:03 - Example 4 - filter
09:00 - Example 5 - filter
09:26 - Example 6 - filter
11:36 - Array.reduce() function in JavaScript
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
akshaysaini.in/
Would love to Stay Connected with you β€οΈ
LinkedIn - www.linkedin.com/in/akshaymarch7
Instagram - www.instagram.com/akshaymarch7
Twitter - twitter.com/akshaymarch7
Facebook - www.facebook.com/akshaymarch7
#NamasteJS #AkshaySaini
All Comments (21)
-
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. π₯³π₯³π₯³
-
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);
-
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);
-
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)
-
Please cover the following topics: 1. async/await 2. Observables 3. Promise
-
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 πππ
-
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
-
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)
-
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 πππ
-
Esses indianos sabem demais. Tu Γ© doido! Salvando sempre. NamastΓͺ π
-
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..
-
Solution of the homework: const output = users.reduce((prevVal, currVal) => { if (currVal.age < 30) { prevVal.push(currVal.firstName); } return prevVal; }, []);
-
Please continue this series sir ,as we want to learn more about things like promises , async-await , fetch api , OOPS in javascript and more on functional programming.
-
11:49 Found the answer for why reduce is named so. According to an article on digital ocean - "A reducer will only return one value and one value only hence the name reduce." In simple terms, it reduces the array to a single value.
-
// 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; }, []);
-
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!!
-
Sir, Please complete Namaste Javascript series. This is a request on behalf of all javascript developers..
-
Best explanation for all this important array methods!! Reduce example- Const output=users.reduce((acc,curr) =>{ If(curr.age<30){ acc=[...acc, curr.firstName ]; } return acc; },[])
-
Homework done sir let array = users.reduce((acc, crr) => { if (crr.age < 30) { acc.push(crr.firstName); } return acc; }, []); console.log(array);
-
No words can express, how grateful I am for your explanation. you killed it! THANK YOU!