ES6 Tutorial #8: map, reduce and filter| Interview Question| Modern Javascript 2021
Vložit
- čas přidán 2. 07. 2024
- map, filter and reduce are the most important Higher Order functions in javascript that works with Array to modified or transform your data.
I have explained these methods with basic to advance examples. Please watch the video till the end to get the best out of it. There is one problem solving assignment at the end for you :)
Please support my channel,🙏 by showing your love❤️ by liking and sharing my video, so that I can reach to more people and can help them too.
00:00 - Introduction
00:50 - Array.map()
09:25 - Array.filter()
13:38 - Array.reduce()
19:08 - Complex example(combing map, reduce and filter)
24:20 - Method chaining
25:55: Assignment
26:20: Thanks for watching 🙏
Watch my Angular playlist :
Angular : • Introduction- Angular ...
Follow me:
Facebook: / angularjs4beginners
LinkedIn: / nisha-singla-82407aa0
Instagram : / passion4code
For more such interesting videos, please subscribe to my channel and stay connected.
#javascript #NishaSingla
Hey, here is the Assignment:
const totalScoreRating = emply.reduce((acc, value)=> {
if(value.title === 'Senior Developer'){
acc += value.rating1 + value.rating2;
}
return acc;
},0);
console.log(totalScoreRating);
Put videos about closure, function currying, call, apply, bind...
Watch complete Playlist on javascript here: czcams.com/play/PLC8OkhrVTHNFzxNVvdtCmTw5OSYs4wv5H.html
Do let me know how you found this video? I read all the comments, would love to hear your feedback! ❤️
You are one of the best teachers!! Thank you for these amazing videos 👍
Thank you so much 😊
Watching you content i cracked top 5 mnc interview in angular and javascript. Thanks
This comment means a lot 🙏🙏
Really happy to know that I am able to help someone 😀😀
👍
wahhhh mam kya explain kiya hai apne.......very good explanation , especially reduce()😊😍🥰
Awesome ❤️
Best
Helpful!
26:17 Assignment .
const total = employees.reduce((accumlator, value) => {
value.profile ==="Senior Developer"?accumlator += value.rating1 + value.rating2: accumlator;
return accumlator;
}, 0);
Hello nisha thanks for all the videos they are clear and simple no beating around the bush straight to the point videos !! I request you to please make video on reactive forms and template driven forms .. TIA !
Thank you so much 😊.. sure will update soon 👍🏻
Hi Nisha, Thanks for sharing such a wonderful videos . Because of your tutorials, today I am able to read my company code like a text book. You boost my confidence.
Thanks Ritesh.
Really glad to know about this 😀😀 wish you good luck 🤞🏻
Thank you so much Teacher 🙏
👍👍👍
😀😀
Super mam big applause
Hi Nisha, you are gifted with explaining concepts so clearly that I get hooked onto your tutorials. Thank you!
Thanks… good to know u found it useful🙏
Can you make vedio on jwt authentication and authorization in angular
Well done keep upload js interview questions...
Thanks 😊
Mam your video is very awesome can you make like ecommerce website videos
Thanks Nisha, Please try to do all videos in JavaScript
Sure …Make sure you have pressed the bell icon.. you will get notify for my all new upload … 😀😀
@@NishaSingla sure
which method of evaluation is faster between logical operator and ternary operator
Hey Nisha thanks for these amazing videos on JS. I hope you will create more videos on js angular. Thank you so much!
const result = employees.reduce((acc, emp) => {
if(emp.profile === 'Senior doveloper') {
let output = emp.rating1 + emp.rating2;
acc = acc + output;
}
return acc;
}, 0);
console.log(result);
Mam can you upload videos on spring boot as well?
For that I need to learn spring boot first 😬😬
What is higher order functions?
Will upload video on that .. stay connected 😃
High order function is a function which accept function as an argument and/or return function
Thanks Amit
You can watch the video on higher order function here
czcams.com/video/BwyFLRVYbvU/video.html
Hi, Here is my assignment
let totalValue = employees.reduce((acc, emp) => {
if(emp.role == "Senior Developer"){
acc += (emp.rating1 + emp.rating2)/2
}
return acc;
}, 0)
console.log(`Reduce Operator => ${totalValue}`);
const TotalRating= employes.reduce((acc, val) => {
return (val.role === 'SE' && val.rating1 + val.rating2) + acc;
},0);
console.log("Total Rating !",TotalRating);
The solution of the assignment:
Sum up the ratings of all the Senior Developer only using reduce method:
const employee = [
{id:101, name: "ashish", profile: "Senior Developer", rating1:5, rating2:10},
{id:102, name: "ashok", profile: "Junior Developer", rating1:6, rating2:10},
{id:103, name: "aman", profile: "Senior Developer",rating1:7,rating2:7},
{id:104,name:"ashu",profile:"Senior Developer",rating1:8,rating2:7},
{id:105,name:"anjan",profile:"Junior Developer",rating1:9,rating2:10},
];
const seniorCount = employee.reduce((acc, curr)=>{
if(curr.profile === "Senior Developer"){
acc += curr.rating1 + curr.rating2;
}
return acc;
},0);
console.log(seniorCount);
Using map, reduce and filter method :
const seniorCount = employee.filter((item)=> item.profile == "Senior Developer").map((x)=>x.rating1 + x.rating2).reduce((x,y)=>x+y,0);
console.log(seniorCount);