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

Поділитися
Вставка
  • Опубліковано 18 чер 2024
  • #JavascriptInterview #Javascript #FrontendInterview
    Javascript Interview Questions on functions will be discussed in this video including topics like Function Hoisting, Scope, Callback Functions, Arrow Functions, IIFE, Closures etc
    🟦 Follow me on Twitter and u will clear your interview 🤓 -
    / piyush_eon
    ⭐ Support the channel and learn from me One on One -
    / @roadsidecoder
    🔗 Var, Let and Const Interview Video -
    • Javascript Interview Q...
    🔗 Map, Filter and Reduce Interview Video -
    • Javascript Interview Q...
    🔗 Javascript Interview Series -
    • Javascript Interview Q...
    🔗 Cars24 Interview Experience -
    • Frontend Interview Exp...
    🔗 Unacademy Interview Experience -
    • Frontend Interview Exp...
    🔗 MERN Stack Tutorial with Redux -
    • MERN Stack Project Tut...
    🔗 React Beginner's Project Tutorials -
    • React JS Project Tutor...
    -------------------------------------------------------------------------
    00:00 Intro
    00:43 Function Declaration
    01:08 Function Expression
    01:29 Anonymous Function
    02:20 First Class Functions
    03:49 What is IIFE?
    05:00 IIFE - Interview Question
    05:54 Closures
    06:22 Function Scopes
    08:05 Function Scope - Interview Question
    09:13 Hoisting in Functions
    12:35 Hoisting - Interview Question
    14:41 Params vs Arguments
    15:20 Spread vs Rest Operators
    16:38 Interview Question on params, args, spread, rest
    17:58 Callback Function
    18:57 Callback Function - Interview Questions
    19:53 Arrow Functions
    20:54 Arrow function vs Normal Function
    23:55 Do this for Goodluck
    -------------------------------------------------------------------------
    Special Thanks to our members -

КОМЕНТАРІ • 116

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

    🔴 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

  • @shubhamkakad10x
    @shubhamkakad10x 4 дні тому +1

    thank you so much no one explaining as you do

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

    Next make on this keyword and some React live coding challenges

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

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

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

    Your explanation is very good, simple and correctly explained

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

    Please post as many as possible interview video s 👍

  • @aishwaryashetty1094
    @aishwaryashetty1094 3 місяці тому +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 🥰💝

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

    so much to learn !

  • @zhumabayevorymbek2548
    @zhumabayevorymbek2548 2 місяці тому

    Very useful!) explained a lot

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

    Very insight full

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

    Thank you so much.

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

    Thanks you for this 💛

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

    Thanks for sharing 👍

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

    Thanks!!

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

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

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

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

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

    Awesome 👍😎

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

    very informative

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

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

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

    Great video

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

    Superb 👍❤️

  • @Solo_playz
    @Solo_playz Рік тому +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 10 місяців тому

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

  • @cristianfernando2951
    @cristianfernando2951 6 місяців тому

    excelent video bro

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

    You explain it so well , loved tNice tutorials tutorial.

  • @RahulYadav-rv5tk
    @RahulYadav-rv5tk Рік тому

    now i am in a good mood

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

    amazing

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

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

    Thanku Bhaiya

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

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

    Good day!
    Gratitude for your kindness and efforts

  • @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

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

    Thank you piyush sir 😊 keep it up

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

    Do more videos .. Expecting dialy

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

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

  • @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 👏

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

    Please make a video on react interview questions

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

    Can you make series for MERN interview questions

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

    Can you explain reactjs local persistence

  • @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 8 місяців тому

      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 8 місяців тому

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

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

    Awesome video bhaiya....

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

    @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

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

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

  • @vishalzinjade6094
    @vishalzinjade6094 Рік тому +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

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

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

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

    please make videos js interview questions

  • @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

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

    💥

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

    Please make videos on machine coding round asked questions 🙇

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

    Bhai react ke questions bhi dal do

  • @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......❤

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

    MDN is the best resource to learn js ..

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

    oh bhai thoda regular raho .

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

    First class function or higher order function

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

    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  Рік тому +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

  • @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..??

  • @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

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

    Js array methods se IQ bana do bhai

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

    💯👌👌

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

    Functions are first class Objects/Functions in JavaScript.

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

    Explain high order functions

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

    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

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

    13-oct

  • @himanshuarora1910
    @himanshuarora1910 9 місяців тому

    the answer at 14:42 is undefined right ?

  • @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

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

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

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

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

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

    Hi bro

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

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

    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  5 місяців тому +1

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

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

      callback hell is not relevant here, check promises video

  • @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. 😆

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

    Mdn is also fan of roadside coder .😂😂

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

    Spread operator always be last one😶😶😶

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

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

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

  • @whitelegend5975
    @whitelegend5975 6 місяців тому

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

  • @Anandkumar-tc5os
    @Anandkumar-tc5os 11 місяців тому

    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() ?????