Javascript Interview Questions ( Functions ) - Hoisting, Scope, Callback, Arrow Functions etc

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 130

  • @RoadsideCoder
    @RoadsideCoder  2 роки тому +17

    🔴 Get my Complete Frontend Interview Prep course - roadsidecoder.com/course-details
    If this video gets good response, I will make more JS interview videos, so do share it with others 🔥

    • @preetikabra5737
      @preetikabra5737 2 роки тому

      Piyush sir please a video on portfolio website with react js

    • @RoadsideCoder
      @RoadsideCoder  2 роки тому

      @@preetikabra5737 Sure

  • @A1996ARP2075
    @A1996ARP2075 2 роки тому +21

    Next make on this keyword and some React live coding challenges

  • @sonibhandari7548
    @sonibhandari7548 2 роки тому +4

    Your explanation is very good, simple and correctly explained

  • @hi-yi7en
    @hi-yi7en 2 роки тому +10

    Please post as many as possible interview video s 👍

  • @m.z6437
    @m.z6437 2 роки тому +7

    just watch for 3 min and i am getting all the answers that i am trying to find from so long, awesome work bro.

  • @shubhamkakad10x
    @shubhamkakad10x 5 місяців тому +1

    thank you so much no one explaining as you do

  • @aishwaryashetty1094
    @aishwaryashetty1094 8 місяців тому +1

    Just took a moment in between watching the video to appreciate you, you have explained all the concepts amazing and with such clear explanation. Please keep up your good 🥰💝

  • @akarsh1996
    @akarsh1996 2 роки тому +6

    Your videos helped me a lot in cracking interviews. Thanks a lot.

  • @RahulKumar-ew1qw
    @RahulKumar-ew1qw 2 роки тому +4

    Most valuable for tricky question and in interview time , thank u brother....

  • @CodeWithSachinTiwari
    @CodeWithSachinTiwari 2 місяці тому +1

    Thank you @RoadsideCoder , for the excellent explanation! However, at 8:35 in the video, you mentioned that the output of the for loop is 0, 1, 2, 3, 4, 5. This is incorrect; it should be 0, 1, 2, 3, 4. Please make this correction.

  • @Solo_playz
    @Solo_playz 2 роки тому +8

    The examples of callback function you gave are all called higher order function instead these functions accept callbacks as an argument.
    Ya I can understand that sometimes they confused us lot don't worry , stay connected with us we all need your content we are liking this so much.

    • @Lavith_kuttu
      @Lavith_kuttu Рік тому +3

      In JavaScript, a callback function is a function that is passed into another function as an argument. A “higher-order function” is a function that accepts functions as parameters and/or returns a function.

    • @sahilarora7186
      @sahilarora7186 Рік тому

      that's true, but first class function are assigned to a variable. @@Lavith_kuttu

  • @shashidharvarne1059
    @shashidharvarne1059 2 роки тому +1

    Just finished watching all the videos in this playlist. Thank you so much! It really helps

  • @mrrishiraj88
    @mrrishiraj88 2 роки тому +1

    Good day!
    Gratitude for your kindness and efforts

  • @SHAKTI2.O
    @SHAKTI2.O 3 місяці тому

    UA-camrs like you are really contributing to society...thanks bhaiya 🎉

  • @stockmarketnewsanalysis4658
    @stockmarketnewsanalysis4658 3 місяці тому

    Simply awesome 🙌

  • @alwysrite
    @alwysrite 2 роки тому +1

    so much to learn !

  • @zhumabayevorymbek2548
    @zhumabayevorymbek2548 7 місяців тому

    Very useful!) explained a lot

  • @Dev-Phantom
    @Dev-Phantom 2 роки тому

    Very insight full

  • @vishalzinjade6094
    @vishalzinjade6094 2 роки тому +6

    Very Nice Video !!
    In last question, I guess one point is missing.
    In arrow Function, hoisting doesn't work (It only works for regular function).
    For example:
    This will work:
    console.log(addNum(5, 6))
    function addNum(a, b) {
    return a + b
    }
    But This one will not:
    console.log(add(5, 6))
    const add = (a, b) => {
    return a + b
    }
    Please correct me.

    • @GauravKumar-ue7nz
      @GauravKumar-ue7nz Рік тому

      Exactly This point got missed.

    • @rushikeshgandhmal
      @rushikeshgandhmal Рік тому +1

      Normal functions are hoisted, function expressions/array functions are not hoisted !

    • @Lavith_kuttu
      @Lavith_kuttu Рік тому +1

      @@rushikeshgandhmal yes function expression and arrow function are not hoisted

  • @pradyumnagarg
    @pradyumnagarg 2 роки тому +3

    Great content, got some more questions while taking interview for new candidates.
    Also to add one point related to function expression
    If we create a function expression using var and const keywords and invoke before its declaration, we would get different set of errors.
    1. var - can't invoke function before initialisation.
    2. const - "functionName" is not a function.
    Hope this helps someone, debugging any bug. 😁

    • @hasibalfuad9652
      @hasibalfuad9652 Рік тому

      I think you wrote it in other way around.
      For var it says - "functionName" is not a function.
      For let and const = cannot access "functionName" before initialization.
      It showed these two when I run those. Am I missing something?

    • @pradyumnagarg
      @pradyumnagarg Рік тому

      @@hasibalfuad9652
      You are right!
      Its the other way around.
      Basically for var, it hoists with undefined as the value so it says "it's not a function"
      On the other hand for const, its in temporal deadzone, eventually we can't access it until compiler reaches to the point where it is initialized.

  • @DS-zr9gv
    @DS-zr9gv Рік тому

    Thanks you for this 💛

  • @ankushladani496
    @ankushladani496 2 роки тому +1

    Awesome video bhaiya....

  • @RahulYadav-rv5tk
    @RahulYadav-rv5tk 2 роки тому

    now i am in a good mood

  • @lifeisbeautifu1
    @lifeisbeautifu1 Рік тому

    Thank you so much.

  • @jhaganb9215
    @jhaganb9215 2 роки тому +3

    Hi bro , I have a question/s
    Is there any possible way to get front-end intern (do they exist? or are they any company offering them?) and how to find them ?
    and how to make a strong front-end intern resume

  • @nibsprogramming7794
    @nibsprogramming7794 2 роки тому

    Thanks for sharing 👍

  • @kashmirtechtv2948
    @kashmirtechtv2948 4 місяці тому

    Awesome brother

  • @swatinalwade972
    @swatinalwade972 2 роки тому

    Thank you piyush sir 😊 keep it up

  • @ujjwalgupta2890
    @ujjwalgupta2890 2 роки тому

    in the function o/p question how i is going to the 5
    even in the for loop u have mentioned that i

    • @RoadsideCoder
      @RoadsideCoder  2 роки тому +1

      When the loop ends its value is 5,that's why it doesn't go inside it. But since the last value was 5, the setTimeout prints that when it executes.

    • @priyankatile1767
      @priyankatile1767 Рік тому

      @@RoadsideCoder with let it will print from 0 to 4 as i

  • @harshalmali856
    @harshalmali856 10 місяців тому

    thank you so much bhai it helped a lotttt...

  • @codlover1468
    @codlover1468 2 роки тому +1

    Awesome 👍😎

  • @rajatawasthi5989
    @rajatawasthi5989 2 роки тому

    Good information share piyush i remember, when I khown noting about java script , and by continue pratice now i aware with of most of things as keep posting videos .

    • @RoadsideCoder
      @RoadsideCoder  2 роки тому

      Thanks a lot Rajat, glad to hear your story.

  • @kedarkulkarni0074
    @kedarkulkarni0074 2 роки тому +1

    Deep copy and shallow copy aur uske use cases ka ek video dal do, wo important hai interview k liye, btw you're doing great job buddy 👏

  • @narenk8077
    @narenk8077 2 роки тому

    Tell me the difference or why we need use function expression and iife

  • @arupde6320
    @arupde6320 2 роки тому +1

    oh bhai thoda regular raho .

  • @cristianfernando2951
    @cristianfernando2951 Рік тому

    excelent video bro

  • @ambeshtiwari9977
    @ambeshtiwari9977 7 місяців тому

    Great video

  • @akash.deep1001
    @akash.deep1001 2 роки тому

    Do more videos .. Expecting dialy

  • @beautylive9656
    @beautylive9656 Рік тому

    Thanku Bhaiya

  • @vardansharma6020
    @vardansharma6020 Рік тому

    Function expression : when a variable is assigned to an anonymous function .
    - what are fc functions . Basically we can pass functions like variable
    - what is iife immediately invoked function expression we can call a function without explicitly invoking it elsewhere .
    -let has block scope whereas var doesnt have block scope
    -functions are hoisted completely
    -hoisting initialized the local scope separately .
    -spread and rest operator
    -rest parameter must be the last formal parameter !!!!!!!!!!!
    -callback function : function passed to another function
    -arrow function : syntax different , implicit return , arguments keyword is not defined inside an arrow function , this keyword inside arrow function refers to global scope

  • @vijaykumarjee
    @vijaykumarjee 2 роки тому

    Superb 👍❤️

  • @lovishduggal9064
    @lovishduggal9064 7 місяців тому

    Thanks!!

  • @himanshuarora1910
    @himanshuarora1910 Рік тому

    the answer at 14:42 is undefined right ?

  • @yolla_4
    @yolla_4 2 роки тому

    very informative

  • @kamkhohao
    @kamkhohao 2 роки тому

    You explain it so well , loved tNice tutorials tutorial.

  • @anirbandas12
    @anirbandas12 2 роки тому

    MDN is the best resource to learn js ..

  • @whitelegend5975
    @whitelegend5975 11 місяців тому +3

    I am preparing for the interview If I got a job then surely I will name my kid as your name 🫠🫠

  • @Zeeexshan
    @Zeeexshan 3 місяці тому

    can we please get the advance version of Arrow VS Normal functions

  • @JohnSnow-gi7iv
    @JohnSnow-gi7iv 2 роки тому

    Is it possible to make an internal transition from frontend to backend or full stack or vice versa or change tech stack while working inside FAANG companies or startups.

  • @rajuprajapati712
    @rajuprajapati712 10 місяців тому

    @RoadsideCoder, thanks for this series and also for the React interview question series. I have this doubt from long time could you please answer this.
    *doubt in section 10 of this video*.
    you put i * 1000 in the time of setTimeOut second parameter so why it is consoling after every 1 second. yaha par 5 iteration hona hai(0, 1, 2, 3, 4) so for the first time i = 0, and for the second time i = 1, and for the third time i =2 and so on. so the value is different every time then why the console is printing after every 1 second.
    Please respond. Thank you

  • @krishnanarasimha1243
    @krishnanarasimha1243 2 роки тому

    Can you explain reactjs local persistence

  • @JohnSnow-gi7iv
    @JohnSnow-gi7iv 2 роки тому

    Please make a video on react interview questions

  • @dakshtevathia
    @dakshtevathia Рік тому

    Functions are first class Objects/Functions in JavaScript.

  • @crystalclear178
    @crystalclear178 2 роки тому

    Can you make series for MERN interview questions

  • @jaisharma545
    @jaisharma545 2 роки тому +1

    Please make videos on machine coding round asked questions 🙇

  • @avinaymishra8345
    @avinaymishra8345 2 роки тому +2

    Sir please make DSA in javascript also sir there is no content on youtube..about DSA in javascript please make DSA video also it will be very helpful for us......❤

  • @rishirathore2373
    @rishirathore2373 Рік тому

    amazing

  • @samiranroyy1700
    @samiranroyy1700 Місяць тому

    Sir❤

  • @chandranvutukuri5047
    @chandranvutukuri5047 2 роки тому

    please make videos js interview questions

  • @gamezone43
    @gamezone43 2 роки тому

    First class function or higher order function

  • @charuhas1602
    @charuhas1602 2 роки тому

    Oops in detail plz.. thanks

  • @rasedkhan570
    @rasedkhan570 2 роки тому

    Bro could you please show how to path redirect in react js

  • @niklausmikaelson7332
    @niklausmikaelson7332 2 роки тому

    Bhai react ke questions bhi dal do

  • @soumyadd7529
    @soumyadd7529 5 місяців тому

    He gives a shraap at the end - “Your code will get errors if you don’t subscribe” 😂

  • @divyakerekar8971
    @divyakerekar8971 2 роки тому

    Explain high order functions

  • @akashchaudhary8066
    @akashchaudhary8066 Рік тому +1

    @akshaymarch7 did it before it was cool! Huge respect for the man really. And kudos to guys like you who are helping us learn over top of what we learned from NamasteJs

  • @surya_traveller1541
    @surya_traveller1541 2 роки тому

    Piyush broo I want complete javascript knowledge can you please provide sources piyush broo and along with practices

  • @poornanayak1406
    @poornanayak1406 Рік тому +1

    hi, i dint understand your question number 7. solution. Why did 'var' print 5 evrytime when it was initialzed from 0 in for() loop. Can u please explain..??

    • @coldventure6668
      @coldventure6668 Місяць тому

      for loop executes way faster than settimout function when the funactions are called by the memory queue for each second they Var value will be 5 so its will print 5 5 5 5

  • @reshabkumar8514
    @reshabkumar8514 2 роки тому

    Js array methods se IQ bana do bhai

  • @kaijisan1206
    @kaijisan1206 Рік тому

    interview questions on javascrit is to find out if you know how javascript's syntaxes and rules are all over the place

  • @soumenkhara5456
    @soumenkhara5456 2 роки тому

    How to import SVG as react component in vite react typescript I check all solutions on the internet but nothing works please help me.

  • @visiion1998
    @visiion1998 Рік тому

    Is JavaScript is same as DSA ???? because these type of questions i use to solve in dsa

  • @rasedkhan570
    @rasedkhan570 2 роки тому

    Bro i have some problem in react + mui combination could you please help

  • @sarthakworks
    @sarthakworks 2 роки тому

    13-oct

  • @vipin3982
    @vipin3982 2 роки тому

    💥

  • @tejusgroup6695
    @tejusgroup6695 2 роки тому

    💯👌👌

  • @souvikdatta97
    @souvikdatta97 4 місяці тому

    One more scenario:
    fun();
    var fun = function () { console.log("hello"); }
    This will not execute
    It will give Type error: fun is not a function

  • @rakaa31
    @rakaa31 2 роки тому +1

    Bro agar 2 week ne ek video daloge toh flow nhi bntaa

    • @RoadsideCoder
      @RoadsideCoder  2 роки тому +3

      Jldi dalne ki kosis karunga. Its hard to manage with job.

  • @krishnanarasimha1243
    @krishnanarasimha1243 2 роки тому

    Hi bro

  • @kumaraditya7795
    @kumaraditya7795 3 місяці тому

    how the f**k the output is displayed in the console of the browser without doing console.log in the function scope topic at 7:54

  • @holicneko1668
    @holicneko1668 2 роки тому

    Hi everybody. I just interviewed for a javascript developer position. Is the entry level. But the company gives 2 tests. iq test and java test. I don't understand what kind. 😆

  • @chepuripavankumar7707
    @chepuripavankumar7707 2 роки тому

    Really very useful questions bro. please make DSA videos bro. those are also asking in the interview.

  • @sangeethal3911
    @sangeethal3911 2 роки тому

    Reallyy a worth watching all the videoss 😍,,,,, u making all the points clr and crisp . Plz make the videos for await asyn vs promise difference , and interview qstns related to tht concepts

  • @markjosh5218
    @markjosh5218 2 роки тому

    Bhai I want Some Information about Inshort clone and Crypto Hunter clone app costing ?
    Bhai Please Reply if its Possible?

  • @sahilpatil9707
    @sahilpatil9707 5 днів тому

    this in normal function: Merko kisne bulaya be (user object ne)
    this in arrow function: Mere bap ko kisne bulaya be (papa ke papa ne which is globalObject)

  • @shivambln
    @shivambln 11 місяців тому

    Callback hell is missing ....... When you are explaining callback function you should have include the callback hell as well ..
    Rest is perfectly fine

    • @RoadsideCoder
      @RoadsideCoder  11 місяців тому +1

      check further videos bro, I have acompletely different section for that. This video is for basics

    • @RoadsideCoder
      @RoadsideCoder  11 місяців тому +1

      callback hell is not relevant here, check promises video

  • @suyashtiwari8492
    @suyashtiwari8492 2 роки тому

    Mdn is also fan of roadside coder .😂😂

  • @pranjalkhobragade9023
    @pranjalkhobragade9023 2 роки тому

    Spread operator always be last one😶😶😶

  • @jkshorts790
    @jkshorts790 11 місяців тому

    Koun koun khan sir के app se आया है

  • @premsingh6967
    @premsingh6967 Рік тому

  • @Anandkumar-tc5os
    @Anandkumar-tc5os Рік тому

    var username='Addy negative';
    var user={
    rc1:()=>{
    console.log('my name is '+this.username)
    },
    rc2(){
    console.log('my name is '+this.username)
    }
    }
    user.rc1(); // "my name is Addy negative"
    user.rc2(); // "my name is undefined"
    Why closure property is not working for rc2() ?????