Using map() to return all names in capital 🔥

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 98

  • @RoadsideCoder
    @RoadsideCoder  10 месяцев назад +3

    👉Watch full video here - ruclips.net/video/dGq0gi0wv64/видео.html
    ➡️ Book an Interview Preparation call with me ( 20% OFF for limited time ) - topmate.io/roadsidecoder

  • @anantsharma13
    @anantsharma13 10 месяцев назад +118

    It is not always the one liner or two liner code but how readable your code is.
    Here it is fine because it was straight forward.

    • @Trendi_Vibes
      @Trendi_Vibes 7 месяцев назад +1

      You have experience bro 🎉

    • @randomviralshorts1501
      @randomviralshorts1501 3 месяца назад +1

      If you can't read code, then you can leave coding
      You don't have any idea , how much pressure we have to bear on those deadlines.

    • @rachitmittal448
      @rachitmittal448 3 месяца назад +2

      ​@@randomviralshorts1501 So You don't know how to write a maintainable, readable and good code. Okay. 👍🏻👍🏻

  • @ankushmalik8257
    @ankushmalik8257 5 месяцев назад +5

    Very good coding questions. Please keep posting more such shorts.

  • @SatyakiBhargava
    @SatyakiBhargava 6 месяцев назад +16

    Its called lambda functions or annonymous function. And code is never messy because of more number of lines. That lambda you wrote is hard to bring in unit test coverage.

    • @gururaviteja
      @gururaviteja 5 месяцев назад

      Why it is difficult

    • @Carrymejane
      @Carrymejane 3 месяца назад +3

      ​@@gururaviteja Every high level of abstraction is hard to understand by machine

    • @surajbokade66
      @surajbokade66 Месяц назад +1

      True first one is not messy it's readable and easily understandable

  • @limpid-green-music
    @limpid-green-music Месяц назад +1

    CSS:
    text-transform: uppercase;

  • @ikoiko6540
    @ikoiko6540 9 дней назад

    also arr.reduce((acc,curr)=>{
    return [...acc,curr.name.toUpperCase()]
    },[]) will be very efficient

  • @kaushikitagib3400
    @kaushikitagib3400 3 месяца назад +2

    actually Space complexity of map is o(n) and for loop people claim it's o(1). but since, we use array for result the auxiliary space still be o(n). 😅😅😅😅

  • @darshanhegde7090
    @darshanhegde7090 8 месяцев назад +4

    Bro map also does same for loop in its inner method and returns new array, 😅 basically it's one and the same

  • @VikashKumar-tr9cq
    @VikashKumar-tr9cq 9 месяцев назад +5

    Isn't this approach taking extra space, (for map approach)

    • @riteshshukla3779
      @riteshshukla3779 8 месяцев назад

      Yup it creates another nested array to store the new result, map method doesn't modifies the original array it creates a new copy of it.

  • @Sean_entt
    @Sean_entt Месяц назад

    Nice👍🏻

  • @MightyIndians
    @MightyIndians 4 месяца назад

    You could have destructed the name to reduce the code further

  • @astitva1368
    @astitva1368 4 месяца назад

    you could've also used the Some function

  • @appwala3728
    @appwala3728 20 дней назад

    But for performance. For each is better.

  • @harshtank4583
    @harshtank4583 6 месяцев назад

    Have used reduce ?

  • @דניאלאביב-ו6ת
    @דניאלאביב-ו6ת 5 месяцев назад

    const capitalStudentsNames = students.map(({name}) => name.toUpperCase());

  • @dashorts6597
    @dashorts6597 10 месяцев назад +5

    It was the easiest question

  • @ardhiyanah5544
    @ardhiyanah5544 9 месяцев назад

    You cant use foreach, since foreach cant return any values but it still able to convert to capitalize

  • @SpideyGuy1122
    @SpideyGuy1122 2 месяца назад

    It wasn't a messy code it was straight forward 😂

  • @smachohalla
    @smachohalla 8 месяцев назад +2

    ok now check the performance between these 3 looping mechanisms and choose which is better

  • @kiranravi-k9p
    @kiranravi-k9p 10 месяцев назад

    Great one ❤

  • @ParvezKhan-ep7zg
    @ParvezKhan-ep7zg 8 месяцев назад

    Touppercase ()

  • @CodeWithObservations
    @CodeWithObservations 4 месяца назад

    What about performance if array has millions of records?

    • @RoadsideCoder
      @RoadsideCoder  4 месяца назад

      It will work, map is just a loop

    • @CodeWithObservations
      @CodeWithObservations 4 месяца назад

      @@RoadsideCoder I think it'll not provide better performance over for loop.

    • @RoadsideCoder
      @RoadsideCoder  4 месяца назад

      Behind the scenes, it uses for loop only

  • @personalatick1916
    @personalatick1916 10 месяцев назад +1

    it will be very easy.. if you have minimum common science👀😐

  • @abisekhdey3286
    @abisekhdey3286 6 месяцев назад +1

    //9a. Convert The names into Upper Case using for of loop
    let student1=[
    {Student: "Abisekh",roll:1},
    {Student: "Pallabi",roll:2},
    {Student: "Subham",roll:3},
    {Student: "Raktim",roll:4},
    ];
    for(let i of student1){
    i.Student=i.Student.toUpperCase();
    }
    console.log(student1);
    //9b. Convert The names into Upper Case using for in loop
    let student2=[
    {Student: "Abisekh",roll:1},
    {Student: "Pallabi",roll:2},
    {Student: "Subham",roll:3},
    {Student: "Raktim",roll:4},
    ];
    for(let i in student2){
    student2[i].Student=student2[i].Student.toUpperCase();
    }
    console.log(student2);
    //9c. Convert The names into Upper Case using forEach loop
    let student3=[
    {Student: "Abisekh",roll:1},
    {Student: "Pallabi",roll:2},
    {Student: "Subham",roll:3},
    {Student: "Raktim",roll:4},
    ];
    student3.forEach((val)=>val.Student=val.Student.toUpperCase())
    console.log(student3);

  • @Lucifer-xt7un
    @Lucifer-xt7un 10 месяцев назад

    Please make a full length video with questions like these on objects bro there is no video on youtube i searched a lot. So it help a lot mutually please reply if you read and consider my request

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад

      Already Made - ruclips.net/video/dGq0gi0wv64/видео.html

    • @Lucifer-xt7un
      @Lucifer-xt7un 10 месяцев назад

      @@RoadsideCoder sir im asking to create a full length video on different types of object coding questions as like u did for arrays in DSA playlist

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад

      That is also made - ruclips.net/video/XnFIX3c7xoI/видео.html

  • @omrout3957
    @omrout3957 10 месяцев назад +1

    Bhai i am commerce background student .Last 2.5 year i learned and make project on MERN stack but some time in my mind create negatives thought's can i make good decision . Make me sure it

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад +1

      give it some time, start with basics and try creating projects on your own without watching tutorials

    • @omrout3957
      @omrout3957 10 месяцев назад

      @@RoadsideCoder Commerce student can become webdevloper

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад

      Yes

    • @omrout3957
      @omrout3957 10 месяцев назад

      @@RoadsideCoder tq so much. Your word felling better

  • @tafaxtra
    @tafaxtra 8 месяцев назад

    Loop performance is far better for large data sets

    • @RoadsideCoder
      @RoadsideCoder  8 месяцев назад

      how? Give me time complexity of both

    • @akashshelar1997
      @akashshelar1997 8 месяцев назад

      Right @tafaxtra

    • @akashshelar1997
      @akashshelar1997 8 месяцев назад

      ​@@RoadsideCoderif we do run any script for longer time then for loop has much more control than map or foreach.

    • @sepdronseptadron
      @sepdronseptadron 7 месяцев назад

      ​@@RoadsideCoderobviously, the time complexity is the same
      but I've heard using map instead of a for loop is a little bit slower; so over a large array, it adds up
      lemme measure and update

  • @adityayads
    @adityayads 9 месяцев назад

    Easiest interview question.

  • @iamworstgamer
    @iamworstgamer 10 месяцев назад

    there can be multiple approach to a stupid question? no, its just getting keys from each object and upper case, every approach is same. choose one which is more idiomatic

    • @raghavkhandelwal8285
      @raghavkhandelwal8285 9 месяцев назад

      He is making up questions for the 1 concept he learned. I think his show off skills are better than his coding skills

  • @Somens8Dworld
    @Somens8Dworld 3 месяца назад

    always use for loop bro

    • @RoadsideCoder
      @RoadsideCoder  3 месяца назад

      map uses for loop behind the scenes

  • @fluffybunny510
    @fluffybunny510 8 месяцев назад

    It production it doesn't works like that, when you have thousands of lines of code

    • @devnishmishra
      @devnishmishra 3 месяца назад

      It will work of its 10^8 also

  • @abdulsaboor2168
    @abdulsaboor2168 4 месяца назад

    Idk why simple for loop look messy for me entire js look messy no hates on js but it syntax is weird compare to other languages i have seen

  • @r9guy_
    @r9guy_ 6 месяцев назад

    For loop was not messy

  • @nemanja7289
    @nemanja7289 9 месяцев назад

    You didn’t mention mighty reduce method

  • @ProgrammingWithExx
    @ProgrammingWithExx 3 месяца назад

    👍

  • @_pro_grammer_
    @_pro_grammer_ 8 месяцев назад

    but it is supposed to be slow actually

  • @UMBERELLA_ACADEMY
    @UMBERELLA_ACADEMY 8 месяцев назад

    Me: There can be multiple approach for this problem
    Interviewer: Mention all aproaches
    Me: Mada.............

  • @inter3988
    @inter3988 4 месяца назад

    Interviewer asks to convert into uppercase?

    • @RoadsideCoder
      @RoadsideCoder  4 месяца назад

      yes, but he wont tell u the toUppercase function

    • @inter3988
      @inter3988 4 месяца назад

      @@RoadsideCoder but I heard that you're allowed to use google or any other source

    • @RoadsideCoder
      @RoadsideCoder  4 месяца назад

      not for such obvious things

  • @TANVEERAHMEDTAJIR
    @TANVEERAHMEDTAJIR 18 дней назад

    What the interviewer asked and what are you doing bro?

    • @RoadsideCoder
      @RoadsideCoder  18 дней назад

      What did i do?

    • @TANVEERAHMEDTAJIR
      @TANVEERAHMEDTAJIR 18 дней назад

      Is it to convert them to uppercase or return names which are in capital letters?

  • @raoasim4927
    @raoasim4927 2 месяца назад

    How about using groupby on the object and then using object.keys to get the name.

  • @armanwarval895
    @armanwarval895 8 месяцев назад

    Interviewer gaved is ..

  • @nimishageek4148
    @nimishageek4148 9 месяцев назад

    Map😊

  • @TechnophileGuy
    @TechnophileGuy 3 месяца назад

    What is stu

    • @RoadsideCoder
      @RoadsideCoder  3 месяца назад

      just a variable name, can be anything

  • @Riuyilmistico
    @Riuyilmistico 10 месяцев назад +2

    What kind of interviewer asks this stuff 😂

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад +1

      from junior devs

    • @raghavkhandelwal8285
      @raghavkhandelwal8285 9 месяцев назад

      For which junior role?
      I don't think you write 3 lines or 1 makes any difference if it is readable. It matters if the complexity also changes.

  • @mailatkaushal
    @mailatkaushal 6 месяцев назад

    Bhai Mera naam 🙌 vrna Rahul rohit hi dekte hai 😂

  • @swetavsavarn5517
    @swetavsavarn5517 7 месяцев назад

    Interviewer vi lagta h hr hi hogi jisko yeh question net pe mil gaya hoga aur wahi chipka di😂😂😂😂

  • @aseemanand1
    @aseemanand1 10 месяцев назад

    Ye esa question college me b nhi puchhte interview toh bht door hai 😂

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад +1

      to fir kya puchte hai?

    • @subhasssadhu
      @subhasssadhu 10 месяцев назад

      ​@@RoadsideCoder Rocket Science 😂

  • @DhananjayKumar-uf5ob
    @DhananjayKumar-uf5ob 8 месяцев назад

    Str in arrow function 😂

  • @piyushghag2404
    @piyushghag2404 6 месяцев назад

    Bro not even kidding my name us Piyush and my role number is 31

  • @LuvxJacqu4li8e
    @LuvxJacqu4li8e 9 месяцев назад

    Sorry no javascript allowed

  • @kuldeepchouhan0143
    @kuldeepchouhan0143 10 месяцев назад

    LinkedIn id

    • @RoadsideCoder
      @RoadsideCoder  10 месяцев назад

      www.linkedin.com/in/piyush-eon/

  • @kbttech
    @kbttech 3 месяца назад

    Noob