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

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 2.6K

  • @ramdey6155
    @ramdey6155 3 ปีที่แล้ว +649

    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. 🥳🥳🥳

    • @akshaymarch7
      @akshaymarch7  3 ปีที่แล้ว +80

      Congratulations, Ram 🎉
      Wish you a great career ahead! ♥️

    • @ramdey6155
      @ramdey6155 3 ปีที่แล้ว +6

      @@akshaymarch7 Thank you souch 😀

    • @ParameshChockalingam
      @ParameshChockalingam 2 ปีที่แล้ว +25

      Just so you know, you are like that one friend who teaches entire subject few hours before exam 😎

    • @gopathotirajesh6956
      @gopathotirajesh6956 2 ปีที่แล้ว +23

      @@akshaymarch7 bro where are you . Please do continue this series. I think there is no one explains the things like you. Please don't stop making videos.

    • @Abhishek-do8mp
      @Abhishek-do8mp 2 ปีที่แล้ว +29

      @@akshaymarch7 hello akshay, I don't know whether you are active or not but please consider our request and upload few more videos on topics like async await, promises, spread and rest operators I believe only you can cover these topics with greater depth of understanding hopefully you're seeing this comment and wish I'd see your smile in upcoming videos this is 22k already thanks for spreading that amount of knowledge on youtube you're one of the reason I tell my juniors that you can learn anything from yt javascript se pyar to krva diya lekin is pyar ko manjil tk to pahucha do.

  • @jagrutsharma9150
    @jagrutsharma9150 2 ปีที่แล้ว +442

    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);

    • @lakshyapant5225
      @lakshyapant5225 2 ปีที่แล้ว +2

      bro agr mai return acc ko if k andrr likh rha hu toh error aa rhi hai so what's the reason behind it....please explain?

    • @jagrutsharma9150
      @jagrutsharma9150 2 ปีที่แล้ว +11

      @@lakshyapant5225 Kyuki accumulator(acc) ki pehli condition me hi aapne return kar diya. Vo function se exit ho jaayega, aage ka process ruk gaya pura.

    • @neharathour6115
      @neharathour6115 2 ปีที่แล้ว +1

      Amazing

    • @ganeshbyale5024
      @ganeshbyale5024 2 ปีที่แล้ว +2

      I tried this homework directly in console but throwing error related to acc.push

    • @jagrutsharma9150
      @jagrutsharma9150 2 ปีที่แล้ว +2

      @@ganeshbyale5024 Can you tell the error. Maybe i will be able to help you. Maybe copy paste your code and error

  • @rahulprajapati8052
    @rahulprajapati8052 3 ปีที่แล้ว +146

    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 👌👌👌

    • @akshaymarch7
      @akshaymarch7  3 ปีที่แล้ว +22

      Hahaha 🤣

    • @dipenchavda6988
      @dipenchavda6988 3 ปีที่แล้ว +3

      No she is not 26

    • @KPoireiNgambaSingha
      @KPoireiNgambaSingha 3 ปีที่แล้ว +13

      i guess her age got "mapped" or "reduced" to 26. pun intended 😆😋

    • @AchayanIn
      @AchayanIn 3 ปีที่แล้ว +2

      @@KPoireiNgambaSingha but you 'filtered' some years after 26 😂😂

    • @abacas2175
      @abacas2175 2 ปีที่แล้ว

      kudos to Deepika😂😂

  • @akshaymarch7
    @akshaymarch7  3 ปีที่แล้ว +70

    All Episodes of Namaste JavaScript Web Series: th-cam.com/play/PLlasXeu85E9cQ32gLCvAvr9vNaUccPVNP.html
    ✅After watching this video, do let me know in the comment, How was the video? I read all the comments, would love your feedback! ❤️

    • @SatyendraSingh-mu2ux
      @SatyendraSingh-mu2ux 3 ปีที่แล้ว +1

      Okay but your videos always awesome thnx

    • @sohillalakiya9254
      @sohillalakiya9254 3 ปีที่แล้ว +1

      Please suggest me js book which helps me to learn js from beginner to pro and thanks for this beautiful video❤️

    • @sadavhusain2126
      @sadavhusain2126 3 ปีที่แล้ว +1

      Video was amazing
      Thanks bro
      Please make video on arrow function and regular function

    • @yashpatel3114
      @yashpatel3114 3 ปีที่แล้ว +2

      @Akshay Saini Sir, Can you please make a video on a small project using all these concepts, with HTML CSS JavaScript, for beginners? So that we know where and how these concepts of your previous videos are used. I know that we can google the project, but your explanation is the best and we can understand all the concepts clearly. Only if it is possible and if it doesn't bother you to show a small project. Thankyou Sir. Please consider😊

    • @dke4772
      @dke4772 3 ปีที่แล้ว +1

      Super simple explanation

  • @amodpatwa1822
    @amodpatwa1822 2 ปีที่แล้ว +67

    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

  • @harshitakohli9308
    @harshitakohli9308 ปีที่แล้ว +43

    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!!

  • @ciciiig
    @ciciiig 3 ปีที่แล้ว +172

    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 🙏🙏🙏

    • @g_pazzini
      @g_pazzini ปีที่แล้ว +1

      same here

  • @ebukaavatar3007
    @ebukaavatar3007 2 ปีที่แล้ว +187

    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)

    • @prikshit8
      @prikshit8 2 ปีที่แล้ว +13

      That’s 12 my friend 😂

    • @prikshit8
      @prikshit8 ปีที่แล้ว +1

      @@hailea726 😂😂

    • @stephen2824
      @stephen2824 ปีที่แล้ว +4

      @@hailea726 and you will all be forever in a friendship closure :)

    • @prathameshyerva7476
      @prathameshyerva7476 ปีที่แล้ว +1

      Another 11 subscribers brother ( I and my 12 friends)

    • @bipolarniba5537
      @bipolarniba5537 3 หลายเดือนก่อน +1

      Another 12 subs( me and my other accounts)

  • @vishwasmehra3644
    @vishwasmehra3644 2 หลายเดือนก่อน +3

    My answer to homework:
    const userList = users.reduce((acc, curr) => {
    if(curr.age < 30) {
    acc.push(curr.firstName);
    }
    return acc;
    },[]);
    console.log(userList);
    This was asked in an interview. Thanks for explaining and letting us know :)

  • @akshaykrishna7292
    @akshaykrishna7292 10 หลายเดือนก่อน +16

    Brother - you are so natural in explaining these concepts! Big thanks 🙏
    let belowFortyReduce = users.reduce((res, user) => {
    if (user.age

  • @mohammadnoushadsiddiqui4786
    @mohammadnoushadsiddiqui4786 3 ปีที่แล้ว +187

    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);

    • @debo01
      @debo01 3 ปีที่แล้ว +3

      const output = user.reduce((acc, curr) => {
      if(curr.age < 30){
      acc.push(curr.firstname);
      }

      return acc;
      }, {}
      );

    • @vinothkumarv9722
      @vinothkumarv9722 3 ปีที่แล้ว

      Thanks akshay bro love you...

    • @ganeshkg007
      @ganeshkg007 3 ปีที่แล้ว +15

      Hi, @@debo01 No, this will not work because you initialized the reduce function with object literals {}. Since we are pushing (.push) the results we should use an array for initialization, just like @Mohammad Noushad Siddiqui did.
      Thanks.

    • @iftekhar_ansari
      @iftekhar_ansari 2 ปีที่แล้ว +3

      @@debo01 no its wrong..you can't use push method to insert a data in object ,push is array 's method

    • @lingangoudad8552
      @lingangoudad8552 9 หลายเดือนก่อน

      How to put these first names into an object?

  • @jst_kishan
    @jst_kishan 3 ปีที่แล้ว +30

    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.

  • @victorartb
    @victorartb ปีที่แล้ว +5

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

  • @pranavkuchimanchi3192
    @pranavkuchimanchi3192 ปีที่แล้ว +30

    // 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;
    }, []);

    • @vidushikagupta2900
      @vidushikagupta2900 ปีที่แล้ว

      can you please explain why you use [] instead of empty object {}

    • @vidushikagupta2900
      @vidushikagupta2900 ปีที่แล้ว

      @@ShrikantKunte Thanks

    • @SonuKumar-yu6yh
      @SonuKumar-yu6yh 10 หลายเดือนก่อน

      because in the final output we need an array of first names of users whose age is less than 30
      @@vidushikagupta2900

    • @gobinda-das-io
      @gobinda-das-io 7 หลายเดือนก่อน

      I also did the same broh

  • @gratusrichard1644
    @gratusrichard1644 3 ปีที่แล้ว +21

    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

  • @jagannathpanigrahy7524
    @jagannathpanigrahy7524 2 ปีที่แล้ว +55

    Sir, Please complete Namaste Javascript series. This is a request on behalf of all javascript developers..

  • @atharvagarwal2067
    @atharvagarwal2067 3 ปีที่แล้ว +54

    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.

  • @lakshmipriyanka8178
    @lakshmipriyanka8178 ปีที่แล้ว

    const names = users
    .reduce(function (acc, curr) {
    if (curr.age < 30) {
    acc.push(curr);
    }
    return acc;
    }, [])
    .map((x) => x.firstname);
    console.log(names);
    This is the homework..
    Thank you sooo much. You explained the concepts very well.

    • @Abhishek-mh4mp
      @Abhishek-mh4mp ปีที่แล้ว

      I think there is no need to add map just change the code
      acc.push(curr.firstName);
      it justs only add firstname to acc

  • @dilipvaliya5301
    @dilipvaliya5301 ปีที่แล้ว +1

    Homework Question!
    const output = input.reduce((arr, curr) => {
    if (curr.age >= 25) {
    // any age
    arr.push(curr.fn);
    }
    return arr;
    }, []);
    console.log(output);

  • @gokulyadavpoomalai6040
    @gokulyadavpoomalai6040 3 ปีที่แล้ว +180

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

    • @SFORSANDEEP
      @SFORSANDEEP 2 ปีที่แล้ว +4

      Exactly.. Please cover those

    • @kdclt
      @kdclt 2 ปีที่แล้ว +1

      Yes please!!!!

    • @vrindakakkar8752
      @vrindakakkar8752 2 ปีที่แล้ว +2

      Yes Please ! Async/await, Observables and Promise..

    • @ayushjain8156
      @ayushjain8156 2 ปีที่แล้ว +1

      yes please cover these topics also

    • @singhkr
      @singhkr 2 ปีที่แล้ว

      go and check the Js mastery by harshith best course

  • @omkart2854
    @omkart2854 2 ปีที่แล้ว +58

    Best explanation for all this important array methods!!
    Reduce example-
    Const output=users.reduce((acc,curr) =>{
    If(curr.age

    • @pankarton5950
      @pankarton5950 2 ปีที่แล้ว +3

      Why not acc.push(curr.firstName)? XD

    • @jahangagan5396
      @jahangagan5396 2 ปีที่แล้ว +6

      const output = users.reduce((acc, cur) => {
      if (cur.age < 30) acc.push(cur.firstName)
      return acc
      }, [])

    • @giannizamora7247
      @giannizamora7247 2 ปีที่แล้ว +2

      @@jahangagan5396 I like your answer jahan that is what I came up with. I don't really understand Omkar answer of acc = [...acc, curr.firstName]; why are we using spread syntax here

    • @jahangagan5396
      @jahangagan5396 2 ปีที่แล้ว +4

      @@giannizamora7247 It is the another method of pushing elements into the array nothing else.

    • @faizanabbas839
      @faizanabbas839 2 ปีที่แล้ว

      @jahan gagan Write a PURE function using map,filter and reduce methods to calculate the income tax given an amount. 0 upto 2.5L, 5% for 2.5L-5L, 20% for 5L-10L, 30% for more than 10L. Can you help me with this please

  • @sohamderoy2505
    @sohamderoy2505 2 ปีที่แล้ว +90

    Solution of the homework:
    const output = users.reduce((prevVal, currVal) => {
    if (currVal.age < 30) {
    prevVal.push(currVal.firstName);
    }
    return prevVal;
    }, []);

    • @abhisekgupta4678
      @abhisekgupta4678 2 ปีที่แล้ว +1

      the thing is the output is not an array it doesn't have []

    • @shrimalishrimali7170
      @shrimalishrimali7170 2 ปีที่แล้ว

      Exactly, that's the same thing i thought

    • @mohitbansal321
      @mohitbansal321 2 ปีที่แล้ว +1

      @@abhisekgupta4678 you need only name so it make output in the form of array

    • @apamibrahim1736
      @apamibrahim1736 ปีที่แล้ว

      ​@@mohitbansal321yh😊

    • @mayurtanna3692
      @mayurtanna3692 ปีที่แล้ว

      const max30 = people.reduce((acc, curr) => {
      if (curr.age > 30) {
      // acc = curr.firstName;
      acc = curr.firstName + " " + curr.lastName
      }
      return acc;
      }, {});
      console.log(max30)

  • @vijaypanchal7344
    @vijaypanchal7344 8 หลายเดือนก่อน

    Striving for a comprehensive understanding of all concepts is commendable.

  • @dewansh108
    @dewansh108 ปีที่แล้ว +1

    Thanks for explaining the javascript in so detail
    H.W
    const output = users.reduce((acc,curr) =>{if(curr.age < 30){acc.push(curr.firstname);} return acc},[])
    console.log(output);

  • @barrosofilho42
    @barrosofilho42 3 ปีที่แล้ว +15

    Esses indianos sabem demais. Tu é doido! Salvando sempre. Namastê 🙏

  • @AakashGoplani
    @AakashGoplani 3 ปีที่แล้ว +53

    11:50 - Name reduce was assigned with a purpose to maintain similarity between languages. We have similar reduce (and map, filter as well) in other languages also - Java, Python, Scala, Ruby etc. So having a consistent naming convention will be very easy for developers to get up and running when they switch from one language to another!

    • @asadrahman6123
      @asadrahman6123 2 ปีที่แล้ว +5

      also it reducing from multiple value(array) to single value

  • @partspieces8165
    @partspieces8165 6 หลายเดือนก่อน

    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..

  • @TegeneFikadu
    @TegeneFikadu หลายเดือนก่อน

    wow you are the only man that express map,filter and reduce in simple way God blase you

  • @athilnath
    @athilnath 3 ปีที่แล้ว +8

    I was learning reduce from the video by coding myself and when I tried without assigning an initial value to the acc argument, the first element in the array was assigned to it automatically and the second element was assigned to the curr argument, just sharing an interesting fact, you are a great teacher ❤️❤️

  • @venkyakshaya
    @venkyakshaya 2 ปีที่แล้ว +17

    Hey Akshay 😍 I landed a fully front end position at Adobe. You are a gem Your tutorials were like a one place stop. I didn’t refer to any other documentation or tutorial. Made my life easy. Thank you so much ❤️❤️ This community is awesome because of people like you 🔥

    • @Abhishek_Poddar
      @Abhishek_Poddar 2 ปีที่แล้ว +3

      first of all a very congratulations Akshaya ma'am , it will be a very kind of you if you may tell from where did u referred rest of the topics of this series , from where Akshay saini sir left this series ????

    • @venkyakshaya
      @venkyakshaya 2 ปีที่แล้ว +4

      @@Abhishek_Poddar Could you tell me what you mean by rest of the topics? Interviews mostly cover the fundamentals. There were no targetted question based on syntax so in my view I think if you complete this playlist you can answer most interview questions on JS.

    • @binarybulletin
      @binarybulletin หลายเดือนก่อน

      @venkyakshaya please let me know I want to see how you get opportunity in adobe and how can I get..?

  • @РусланМагамедов-л3м
    @РусланМагамедов-л3м 3 ปีที่แล้ว +21

    You're such an excellent teacher. PLEASE DON'T STOP

  • @PlacementPreparation-yq3ns
    @PlacementPreparation-yq3ns 4 หลายเดือนก่อน +1

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

  • @Himanshu-ow3ge
    @Himanshu-ow3ge 2 ปีที่แล้ว

    // homework : find firstName of all the uers whose age is less than 30 using reduce()
    const output = users.reduce(function(acc, curr){
    if(curr.age < 30){
    acc.push(curr.firstName);
    }
    return acc;
    }, []);
    console.log(output);
    Thank you for this beautiful video❣

  • @siddharthabose9957
    @siddharthabose9957 2 ปีที่แล้ว +21

    const output2=users.reduce(function(acc,curr){
    if(curr.age

  • @mohitkushwaha8156
    @mohitkushwaha8156 3 ปีที่แล้ว +5

    You are a true godsend! You’ve got all of the best qualities of a good teacher. Without you, I wouldn’t have made it through.

  • @purvijha4289
    @purvijha4289 2 ปีที่แล้ว +18

    Can we please get a graphql and react series with this much depth your quality of course is far far good than those paid courses

  • @ranjithasampangi7644
    @ranjithasampangi7644 ปีที่แล้ว

    const output1 = users.reduce((acc, curr) => {
    if (curr.age < 30) {
    acc.push(curr.firstName);
    }
    return acc;
    }, []);
    console.log(output1);
    Thanks a lot!!!!!! Really i was always frustrated with reduce cause i could not understand completely and found it hard. you just made it so easy n i solved all the extra problems before watching your solution. I just love the way you teach and make it so simple that anyone could understand

  • @sujendragharat9645
    @sujendragharat9645 2 ปีที่แล้ว +5

    Hats off to you Akshay for the Content.
    const output = users.reduce((acc, curr) => {
    if (curr.age < 30) {
    acc.push(curr.firstName)
    }
    return acc
    }, []);

  • @mayankkumar6091
    @mayankkumar6091 3 ปีที่แล้ว +4

    I am in more love with Javascript after watching "Namaste Javascript". I have shared it with all of friends and colleagues to strengthen their knowledge about JS.
    Words are not enough to explain the value of this series. Thanks for making this series for everyone with pure love and dedication ❤

  • @nagsai7401
    @nagsai7401 3 ปีที่แล้ว +113

    I don't know but, after seeing notification from namaste javascript I got goosebumps 🔥 🔥, is that the same with everyone !

    • @Fatima-ie5kj
      @Fatima-ie5kj 3 ปีที่แล้ว +2

      @@roshnis8552 yup

    • @vinothkumarv9722
      @vinothkumarv9722 3 ปีที่แล้ว +3

      Exactlly bro ------------------- he is auper man :)

    • @cornensue
      @cornensue 3 ปีที่แล้ว +1

      Yes yes yes....

    • @tauseefanwardo
      @tauseefanwardo 3 ปีที่แล้ว +1

      Yes bro and you should have that goosebumps.

  • @ek_or_ankit
    @ek_or_ankit 2 ปีที่แล้ว

    Solution:
    const output = users.reduce(function(acc,curr){ if(curr.age < 30){ acc.push(curr.firstName);} return acc; }, []);
    Really enjoyed! Thanks.

  • @smileysmiley7689
    @smileysmiley7689 ปีที่แล้ว

    Hi Akshay, As you asked about writing a program using reduce, Here it is :-
    const output = users.reduce(function (acc, curr){
    if (curr.age < 30){
    acc.push(curr.firstName);
    }
    return acc;
    }, [])
    console.log(output);

  • @piyushchandrachandra
    @piyushchandrachandra 3 ปีที่แล้ว +5

    You made this sooo simple to understand!! The reason why this playlist is soooooooo popular! Keep posting great contents.

  • @brijesh220186
    @brijesh220186 3 ปีที่แล้ว +16

    Loved this JS series... The way you cover each topic is awesome... Easy to understand and remain forever. Thank you ❤️

  • @ayoobsaad
    @ayoobsaad 3 ปีที่แล้ว +10

    let arr = [{fname: "first",age: 15},
    {fname: "second",age:31}];
    let output = arr.reduce((acc,curr)=>{
    if(curr.age > 30){
    acc.push(curr.fname)
    }
    return acc
    },[]);
    console.log(output);

    • @vinothkumarv9722
      @vinothkumarv9722 3 ปีที่แล้ว

      Hi Akshay after submitted my answered then i am coming to others how they are answered

  • @codeviksha9295
    @codeviksha9295 2 ปีที่แล้ว

    done with homework Akshay :)
    const output=arr.reduce(function(acc,curr){
    if(curr.age>15)
    acc[curr.firstname]=curr.firstname;
    return acc;
    },{})
    console.log(output);

  • @matt_eberflus
    @matt_eberflus ปีที่แล้ว +1

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

  • @klutzy_
    @klutzy_ 3 ปีที่แล้ว +14

    I've watched many tutorials on this topic, but this one is truly the best!

  • @shalinikarkera2387
    @shalinikarkera2387 2 ปีที่แล้ว +5

    I regret for not finding your channel earlier :( still neva too late :) . So much clarity and that eager to make viewers understand the topic. Hats off. Thanks a lot.

  • @nitingupta1650
    @nitingupta1650 3 ปีที่แล้ว +27

    I believe in Namaste Javascript supremacy! Akshay Saini for the president xD

  • @anushkajaiswal3999
    @anushkajaiswal3999 ปีที่แล้ว +1

    const output = users.reduce(function (acc, curr) {
    if (curr.Age < 30) {
    acc.push(curr.firstName);
    }
    return acc;
    }, []);
    console.log("Those, below the Age of 30 are "+ output);

  • @Rajivsingh-xb1nw
    @Rajivsingh-xb1nw ปีที่แล้ว +2

    Home Work Solution:-
    Ques:- To find firstName all the person whose age is less than 30.
    const users = [
    {firstName: "akshay", lastName: "saini", age: 26},
    {firstName: "akshay", lastName: "saini", age: 75},
    {firstName: "akshay", lastName: "saini", age: 50},
    {firstName: "akshay", lastName: "saini", age: 26},
    {firstName: "Roshini", lastName: "saini", age: 26},
    {firstName: "Deepika", lastName: "saini", age: 26},
    ]
    const output = users.reduce((acc, curr) => {
    if(curr.age < 30) acc.push(curr.firstName)
    return acc;
    }, [])
    PS: Please upvote if you like the solution.

  • @namratasanger5921
    @namratasanger5921 3 ปีที่แล้ว +20

    Akshay Sir, it's commendable that you are sharing the knowledge with everyone. You are an inspiration for all of us. Btw I did the homework.
    let data = users.reduce((acc,personDetails)=>{
    if(personDetails.age < 30) acc.push(personDetails.name);
    return acc;
    },[]);

  • @KiranKumar-hz8ur
    @KiranKumar-hz8ur 3 ปีที่แล้ว +16

    It's the best series to learn js I have ever seen 🤩
    Please upload atleast one video per week in this series 🤝
    It will be very helpful 🙏

  • @atharvathombre7438
    @atharvathombre7438 3 ปีที่แล้ว +5

    Homework :
    const output = users.reduce((acc, curr) => {
    if(curr.age < 30){
    acc.push(curr.firstName);
    }
    return acc;
    }, []);

  • @yogeshsharma5168
    @yogeshsharma5168 3 ปีที่แล้ว +8

    I'm so happy that I started this series.. I feel so confident now Thank you aksay❤️💯🙌

  • @codewithjaymin
    @codewithjaymin 4 หลายเดือนก่อน

    Hello Akshay Saini sir, I'm Jaymin Darji from Gandhinagar, Gujarat. First of all thank you very much for this Namaste Javascript series. I have learned lot's of new things from this series. I'm BCA graduage and currently doing MCA. I already know the javascript concepts but you have made my javascript knowledge top lavel. I can't stop myself to watch next video.
    One interesting thing I want to tell you, I just started this series at 20/7/2024 and today 24/7/2024 (Done with the whole searies) .
    Once again, Thank you very much 🙏🙏

  • @girishbhargava6367
    @girishbhargava6367 7 หลายเดือนก่อน

    Superb explanation
    console.log(final) ;
    const array = users.reduce( function(arr , user){
    if(user.age < 30){
    arr.push(user.firstName) ;
    }
    return arr ;
    } , [] ) ;
    console.log(array) ;
    Thanks for this amazing video.

  • @bedprakashkushwaha8047
    @bedprakashkushwaha8047 3 ปีที่แล้ว +5

    ultimate no one can do better than this.

  • @nitingupta1650
    @nitingupta1650 3 ปีที่แล้ว +44

    We can do something like this to get the desired output!
    const filterByAge = users.reduce((acc,item)=>{
    if(item.age>30){
    acc.push(item.firstName);
    }
    return acc
    },[])

    • @pranavparashar7137
      @pranavparashar7137 3 ปีที่แล้ว

      but it would be good to use filter here

    • @nitingupta1650
      @nitingupta1650 3 ปีที่แล้ว +1

      @@pranavparashar7137 surely, but that's not the point. The point is whether or not can we achieve the same functionality with reduce.

    • @vishnuvnair756
      @vishnuvnair756 3 ปีที่แล้ว +1

      @@vinothkumarv9722 I love how you are trying to say you like Akshay more even when Deepika is having a crush on you✌

    • @divyansh50
      @divyansh50 3 ปีที่แล้ว +11

      bro you can replace the if statement with this-
      item.age>30 ? acc.push(item.firstName) : " "; return acc
      ONE LINE OF CODE RIGHT !!!

    • @vinothkumarv9722
      @vinothkumarv9722 3 ปีที่แล้ว

      @@divyansh50 sure we. Can do lie this condition rendering as well 😍

  • @chinmayhegde2506
    @chinmayhegde2506 3 ปีที่แล้ว +8

    Your statement "Filter function is actually used to filter" coincided with the Ad that starts with "So you wanna be a Software Engineer at Google".

  • @Samofficial389
    @Samofficial389 7 หลายเดือนก่อน

    No Words for this content just Asowme , Today I got clarity about map(), filter(), reduce()
    # Take Inputs = arr
    const res = arr.reduce((acc, curr) => {
    if (curr.age > 20) {
    acc.push(curr.name)
    }
    return acc
    }, [])
    console.log(res)

  • @poorvashukla
    @poorvashukla ปีที่แล้ว

    This works...
    const reducedArray = users.reduce(function (acc, curr) {
    if (curr.age < 30) {
    acc.push(curr.first)
    }
    return acc
    }, [])
    Thanks Akshay for this series! You are a gem

    • @STURddY_SaCHIN
      @STURddY_SaCHIN 8 หลายเดือนก่อน

      curr.firstName :)

  • @RyleeSmyth
    @RyleeSmyth ปีที่แล้ว +7

    I know I'm already late for this but I have finally completed this JS tutorial today. It's just amazing and I don't have any words to describe and YES along with falling in love with JS, I fell in love with Akshay too 😊

  • @sanchitjaiswal666
    @sanchitjaiswal666 3 ปีที่แล้ว +8

    I would love to see object oriented classes in JavaScript and es6 modules as well

  • @sailyjadhav1111
    @sailyjadhav1111 3 ปีที่แล้ว +18

    Solution for homework: let output = users.reduce((acc,curr) => {
    if(curr.age < 30) {
    acc.push(curr.firstName);
    return acc;
    } else {
    return acc;
    }
    },[]);
    console.log(output);

    • @RohitKumar-kk7fc
      @RohitKumar-kk7fc 3 ปีที่แล้ว +4

      This should work. You don't need 2 return statements.
      let output = users.reduce((acc,curr) => {
      if(curr.age < 30) {
      acc.push(curr.firstName);
      }
      return acc;
      },[]);

    • @sailyjadhav1111
      @sailyjadhav1111 3 ปีที่แล้ว

      @@RohitKumar-kk7fc Correct, i rectified the same.

    • @thalhas9760
      @thalhas9760 3 ปีที่แล้ว

      How to get object instead of array?

    • @sailyjadhav1111
      @sailyjadhav1111 3 ปีที่แล้ว +1

      @@thalhas9760 instead of pushing curr.firstName push curr

    • @hiteshsuthar1097
      @hiteshsuthar1097 3 ปีที่แล้ว

      @@RohitKumar-kk7fc that's correct 👍

  • @vasanthan8520
    @vasanthan8520 8 หลายเดือนก่อน +1

    const usingReduce = names.reduce((acc, curr) => {
    if (curr.age < 30) {
    acc.push(curr.first)
    }
    return acc
    }, [])

  • @inderpreetsingh4176
    @inderpreetsingh4176 7 หลายเดือนก่อน

    I am addicted to the way you teach and changed the way, I used to learn. Now, I always hunt the blogs which go in-depth.
    Here is my H/W
    // find people whose age is less than 30 using reduce
    const users = [
    {firstName: "Inderpreet", lastname:"singh", age:31},
    {firstName: "Rahul", lastname:"Kumar", age:28},
    {firstName: "Akshay", lastname:"Saini", age:20}
    ];
    const output = users.reduce(function(acc, curr)
    {
    if(curr.age

  • @hamzaakbar5321
    @hamzaakbar5321 3 ปีที่แล้ว +16

    @Akshay Saini sir
    assignment done
    const output = user.reduce((acc, curr) => {
    if(curr.age < 30) {
    acc.push(curr.name);
    }
    return acc;
    }, []);
    console.log(output)

    • @mohit96nain
      @mohit96nain 3 ปีที่แล้ว +3

      Nice 💯. Also you can use spread operator instead of push 😊

    • @puneetbajaj9927
      @puneetbajaj9927 3 ปีที่แล้ว +2

      @@omkaranku1981 you can try acc=[...acc,curr.name] . Spread arr elements first and then the next argument should be the element you want to add.

    • @avadhoot05
      @avadhoot05 3 ปีที่แล้ว

      @@mohit96nain but spread operator will create a deep copy everytime so its better to use .push()

    • @akhilsingh52as
      @akhilsingh52as 3 ปีที่แล้ว +1

      @@omkaranku1981
      const output = users.reduce((acc, user) => {
      if (user.age < 30) return [...acc, user.firstName];
      }, []);

  • @jaynilgaglani9480
    @jaynilgaglani9480 3 ปีที่แล้ว +5

    Here's my solution using reduce
    const output = users.reduce((result, {age, firstName}) => {
    if(age < 30){
    result.push(firstName);
    }
    return result;
    }, []);

  • @sourav_96
    @sourav_96 3 ปีที่แล้ว +6

    Din ki suruat js ke sath 🔥

  • @TW-uk1xi
    @TW-uk1xi 9 หลายเดือนก่อน

    After you've cleared all my basics, now I feel like JavaScript is like water and it's really exciting.

  • @AdityaSharan811
    @AdityaSharan811 3 ปีที่แล้ว +9

    Hum first hum first 😂
    Namaste JS is finally here 🔥🔥🔥

  • @yashsinghania1567
    @yashsinghania1567 3 ปีที่แล้ว +7

    Akshay Bhaiya , Please start a small course or a bootcamp for JS from basic concepts to advanced , this content is gold , we need more of your explanation in various concepts and functional concepts. #JSbyAkshaySaini

  • @ashishchopra353
    @ashishchopra353 3 ปีที่แล้ว +46

    Thank you for such a nice content. Really clarified all my doubts with simple and advance examples.
    Home work completed sir. :)
    const output = users.reduce((acc, curr) => {
    if (curr.age < 30) {
    acc.push(curr.firstName);
    }
    return acc;
    }, []);
    console.log(output);
    @Akshay Saini, Can we expect videos on `Iterators` and `generators` in JS in near future ?

    • @saurabhgandhi615
      @saurabhgandhi615 2 ปีที่แล้ว +3

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

    • @shubhanshusahuu
      @shubhanshusahuu 2 ปีที่แล้ว

      Nice

    • @mohdumar5698
      @mohdumar5698 2 ปีที่แล้ว +1

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

    • @mohammedshanshajahan4357
      @mohammedshanshajahan4357 2 ปีที่แล้ว

      @@saurabhgandhi615 what is thelogic of curr.age&&

  • @noorulameen7688
    @noorulameen7688 2 ปีที่แล้ว

    Let output = user.reduce ( function (arr ,obj ){
    if ( obj.age

  • @jalluchakri1528
    @jalluchakri1528 2 หลายเดือนก่อน

    hey! Thanks for explaining the map, filter and reduce
    const users = [
    {
    firstName: "akshay", lastName: "saini", age: 26},
    {
    firstName: "donald", lastName: "trump", age: 75},
    {
    firstName: "elon", lastName: "musk", age: 50},
    {
    firstName: "deepika", lastName: "padukone", age: 26}
    ];
    const output = users.reduce(function (acc, curr) {
    if (curr.age < 30) {
    acc.push(curr.firstName)
    }
    return acc;
    }, [ ] );
    console.log(output);

  • @husler7424
    @husler7424 3 ปีที่แล้ว +4

    Request: Next videos on JAVASCRIPT OOPS concepts please 🙏

  • @sumeetyeola4576
    @sumeetyeola4576 3 ปีที่แล้ว +5

    Liked before watching whole video coz I know it's going to be great.
    Was waiting for your new video, welcome back ♥️

  • @akshaybhinge8780
    @akshaybhinge8780 3 ปีที่แล้ว +13

    Akshay, are you kidding me already crossed 100k. Congrats 👏. You are passionate teacher. ❤

    • @akshaymarch7
      @akshaymarch7  3 ปีที่แล้ว +4

      Thank you so much brother, it was not possible without your love and support! ❤️

    • @akshaybhinge8780
      @akshaybhinge8780 3 ปีที่แล้ว +3

      @@akshaymarch7 Home work
      const users = [
      { firstName:"akshay", lastName:"bhinge", age:26 },
      { firstName:"donald", lastName:"trump", age:75 },
      { firstName:"elon", lastName:"musk", age:50 },
      { firstName:"deeika", lastName:"padukone", age:29 },
      ];
      const output = users.reduce(function (acc, curr){
      if(curr.age < 30){
      acc.push(curr.firstName);
      }
      return acc;
      }, [ ] );
      console.log(output);

  • @AmitKumar-zy1uc
    @AmitKumar-zy1uc ปีที่แล้ว +1

    const users = [
    {firstName: 'akshay', lastName: 'saini', age: 26},
    {firstName: 'donald', lastName: 'trump', age: 75},
    {firstName: 'elon', lastName: 'musk', age: 50},
    {firstName: 'deepika', lastName: 'padukone', age: 26}
    ]
    const ans = users.reduce((acc, curr)=>{
    if(curr.age < 30) acc.push(curr.firstName)
    return acc
    }, [])
    console.log(ans)
    // I like the way you simplify the topics and present them with
    // the most beautiful explanation, THANKS BRO....

  • @prasadaswar9908
    @prasadaswar9908 ปีที่แล้ว

    good example of reduce();
    const numbers = [1, 2, 3, 4, 5];
    const sum = numbers.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
    console.log(sum);

  • @prashantlalwani527
    @prashantlalwani527 ปีที่แล้ว +1

    finally completed yhe whole playlist. Thanks Akshay for the great content.

  • @nitingupta1650
    @nitingupta1650 3 ปีที่แล้ว +6

    when will you release a video on the 'This' keyword in JS. We really need to understand how the binding of "this" is different in the arrow function !!
    BTW, great work till now!

    • @akshaybhinge19
      @akshaybhinge19 3 ปีที่แล้ว

      🙌 I am also waiting for that.

  • @abhishekthakur7578
    @abhishekthakur7578 ปีที่แล้ว +20

    shame on you 🤣🤣🤣🤣🤣🤣🤣

  • @bibek2507
    @bibek2507 10 หลายเดือนก่อน

    in example 8 using initial value as arr[0] is better because it works for negative values as well and ~~ akshay saini is one of the best guru/teacher with amazing teaching skill ~~ :::::::::::: const arr = [-1,-5,-7,-2,-6,-9,-11]
    const output = arr.reduce((acc, curr)=>{
    if(curr > acc){
    acc = curr;
    }
    return acc;
    }, arr[0] )
    console.log(output);

  • @mishen-thakshana
    @mishen-thakshana 5 หลายเดือนก่อน

    Took a deep breath and did this,
    const output = users.reduce((acc, curr) => {
    if (curr.age > 30) {
    acc.push(curr.firstName);
    }
    return acc;
    }, []);
    console.log(output);

  • @alokakc8757
    @alokakc8757 3 หลายเดือนก่อน

    Here is my Solution:
    const out = users.reduce(function (acc, curr) {
    if(curr.age

  • @mdatiquealam8050
    @mdatiquealam8050 ปีที่แล้ว

    const names = user.reduce( (acc, curr)=> {
    if(curr.age < 30) {
    acc.push(curr.firstName) ;
    }
    return acc ;
    }, []) ;
    Thanks a lot, sir.. lovely explanation ❤❤

  • @ritikroshan9681
    @ritikroshan9681 9 หลายเดือนก่อน

    27:13 brought smile on my face even more interactive than my live lectures

  • @abdulqaadir1035
    @abdulqaadir1035 ปีที่แล้ว

    const output = data.reduce((acc, curr) => {
    if (curr.age > 30) {
    acc.push(curr.name)
    }
    return acc;
    }, [])
    console.log(output)
    Thank You Saree ♥ This vedio is amazing ...

  • @TayabaTariq-e9k
    @TayabaTariq-e9k 16 วันที่ผ่านมา

    const arr = [
    {firstName:"sumar",lastName:"ahmad",age:19},
    {firstName:"usman",lastName:"zahir",age:20},
    {firstName:"umar",lastName :"zain",age:52},
    {firstName:"fahad",lastName:"mehmod",age:80},
    {firstName:"subhan",lastName :"ali",age:42},

    ];
    const output =arr.reduce(function(acc,cur){
    if(cur.age

  • @tech-world24
    @tech-world24 ปีที่แล้ว

    last one reduce assignment:-
    const output = users .reduce((acc, curr)=> firstname. age

  • @shreyadhaga2326
    @shreyadhaga2326 7 หลายเดือนก่อน

    Thankyou for the lesson, here is my homework 😸
    const output = users.reduce(function(acc, curr){
    if(curr.age < 30){
    acc = [...acc, curr.firstname]
    }
    return acc
    },[])

  • @AI_Byte_School
    @AI_Byte_School 10 หลายเดือนก่อน

    const output = users.reduce(function (acc , curr) {
    if(curr.age

  • @indieNik
    @indieNik ปีที่แล้ว

    Thank you, Akshay!
    Here is my homework {
    if (c.age < 30) {
    a.push(c.firstname);
    }
    return a;
    }, []);

  • @shaleenchowdhary
    @shaleenchowdhary 5 หลายเดือนก่อน +1

    Homework done sir
    let array = users.reduce((acc, crr) => {
    if (crr.age < 30) {
    acc.push(crr.firstName);
    }
    return acc;
    }, []);
    console.log(array);

  • @utsavkumar4537
    @utsavkumar4537 ปีที่แล้ว

    "Namaste JavaScript by Akshay Saini has been an absolute game-changer for my understanding of JavaScript! 🙏 The way Akshay explains concepts and walks through examples is incredibly clear and insightful. I've learned so much from this tutorial and it's helped boost my confidence in working with JavaScript. Highly recommend this tutorial to anyone looking to master JavaScript! 🚀 #NamasteJavaScript #AkshaySaini #JavaScriptMastery 💡"

  • @indianhits148
    @indianhits148 10 หลายเดือนก่อน +1

    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.

    • @akshaymarch7
      @akshaymarch7  10 หลายเดือนก่อน

      Wow, congratulations to you. Keep rising! 🚀

    • @bhaviljainnnnnnn
      @bhaviljainnnnnnn 10 หลายเดือนก่อน

      is nameste js it enough to crack FE ?

  • @pratiksukhe8560
    @pratiksukhe8560 2 ปีที่แล้ว

    last assignment solution by using reduce
    // 2. reduce
    const result2 = users.reduce((acc, curr) => {
    if (curr.age < 30) {
    acc.push(curr)
    }
    return acc;
    },[]).map(x => x.firstname)
    console.log(result2);