What is Hoisting? | Most Asked JS Interview Question | The Complete JavaScript Course | Ep.32

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

КОМЕНТАРІ • 67

  • @nobody20022
    @nobody20022 7 місяців тому +15

    Summary:
    What is hosting?
    JavaScript Hoisting refers to the process whereby the interpreter appears to move the declaration of functions, variables, classes, or imports to the top of their scope, prior to execution of the code.
    const and let can not access the value before initialization because they are placed in a temporal dead zone. But in var case, it will give undefined.
    But in function, we get values of function because function values are stored during the memory creation phase so we just get access to it.
    this much I understood from this video.
    *Correct me if I am wrong.

  • @GauthamHC99
    @GauthamHC99 Рік тому +10

    Always is used to confuse between undefined and not defined. Got it clear.
    * undefined is not an error, it is a datatype - thinks to remember for beginners

    • @procodrr
      @procodrr  Рік тому +2

      Awesome, I'm glad you learn something new.
      Keep Learning and Sharing 😊

  • @SahilRajput-io6ns
    @SahilRajput-io6ns 8 місяців тому +6

    Best way of explaning thanks
    saw so many videos on this topic all are saying hoisting is to move the declarations to the top but you explained in detail how javascript hoisting is working in background thanks for making this video😊

    • @procodrr
      @procodrr  8 місяців тому

      Awesome, keep learning and sharing 😊

  • @AdarshSingh-hm8ss
    @AdarshSingh-hm8ss 8 місяців тому +1

    00:02 Hoisting in JavaScript is a commonly asked topic in interviews
    02:46 Hoisting in JavaScript moves variable and function declarations to the top of their containing scope.
    04:39 Hoisting in JavaScript allows accessing variables before their declaration without errors.
    07:15 JavaScript hoists variable and function declarations
    09:39 Hoisting in JavaScript allows function and class declarations to be accessed before they are defined.
    11:56 Function declaration hoisting in JavaScript
    14:19 Hoisting in JavaScript allows function declarations to be moved to the top of the code.
    16:48 Hoisting in JavaScript explained
    19:27 Understanding function declaration, definition, and hoisting in JavaScript
    21:51 Hoisting is a process of moving variable and function declarations to the top in JavaScript
    23:49 Understanding function declaration vs. function definition
    Crafted by Merlin AI.

  • @mdfurquanalam786
    @mdfurquanalam786 9 місяців тому +1

    I have seen a first time a youtuber who always reply (or give heart) on the viewer's comment.. I really appreciate it bhaiya..

    • @procodrr
      @procodrr  9 місяців тому +1

      Thank you ❤️

  • @souvik5560
    @souvik5560 10 місяців тому +2

    Clear explanation with proof 👍🏻

  • @zuhairrehman2526
    @zuhairrehman2526 6 місяців тому +1

    Very nicely explained! My memory creation phase is running at full speed now!

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

    Day 11: video 32 completed ....thank you sir making such great video 😊

  • @pranabdas3691
    @pranabdas3691 9 місяців тому +2

    Anurag bhai on fire.....❤‍🔥❤‍🔥❤‍🔥❤‍🔥❤‍🔥❤‍🔥

  • @Sumeet_Katkade
    @Sumeet_Katkade 10 місяців тому +2

    i like it....... i like this video also now total like is =70....this guy deserve more like and subscriber...

  • @ParvezKhan-ep7zg
    @ParvezKhan-ep7zg 9 місяців тому

    🎉🎉🎉 bhot Hi Simple Way me Explain kardiya ❤❤❤ 10 out of 100 💯💯💯💯😁

  • @abhishekkumar-ub2ln
    @abhishekkumar-ub2ln 6 місяців тому +4

    I felt it, when you said, @24:05 anonymous ki spelling bahut khatarnak hoti h(CBSE wale is pain ko kabhi nhi samajh sakte.)

  • @SUJAL-FACT-YT
    @SUJAL-FACT-YT 6 місяців тому +1

    awesome sir , ky bolu sir sabd nhi hai bolne ke liya , aap itna aacha padte hai , love u

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

      ❤️❤️

  • @deepend101
    @deepend101 10 місяців тому +2

    anonymous ki spelling bahut khatarnaak hoti hai 24:00, waah bhaiya maje aate hai video dekhte samay, baaki clear cut this topic...🤣🤣😂😂

  • @simransah6083
    @simransah6083 Місяць тому +1

    Sir, function expression m jab uss function ko call krte h tab uski memory allocation phase nhi hoti kya..kyuki debugger lga n k baad jab function call krte h toh wo variable tab tak nhi dikhata jab tak usme variable assign na ho..esa kyu hota h?

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

    Simple and good easy to understand

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

    Wah Sir poora concept clear❤

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

    Awesome lecture ☺️ sir.

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

    Episode 32 completed bhaiya ji❤

  • @akshayiitk4440
    @akshayiitk4440 9 місяців тому +1

    Very good resoucre you are , i wonder why this video has only 2k view

  • @vikasmv5952
    @vikasmv5952 7 місяців тому +1

    Hi sir ,
    You just explained everything in detailed really like how you explain.
    Just had one doubt
    As we know var , let , const all are hoisted but let and const go yo temporal dead zone and we cannot access it until it is initialized.
    Now just will give 3 examples
    Eg 1
    Let a = 0
    Console.log(a)
    Output = 0
    Eg 2
    Console.log(a)
    Let a= 3:
    Output : cannot access a before initialization.
    Eg 3
    Let a;
    Console.log(a)
    a=2;
    Output : undefined
    I understood 2nd but 3rd as during memory allocation phase a will be undefined and as its declare using let it will go to temporal dead zone and we cannot accept until it is assigned with value , so in this case how we are getting undefined.

    • @SauravKumar-nn1xv
      @SauravKumar-nn1xv 5 місяців тому +1

      In your third example , javascript engine automatically initialized a variable during memory execution phase with undefined value. Hence it is out of TDZ . 😊

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

      This is a good point. I'll make a video on it and explain in detail.

    • @utkarshsrivastava4192
      @utkarshsrivastava4192 Місяць тому +1

      For let and const there will be temporary dead zone if we use them before " declaration".....we need to see "declaration" not "initialisation".......... In 3rd example you are getting the output because there is no temporal zone created as we are using the variable after declaration

  • @editworld3581
    @editworld3581 8 місяців тому

    Well explained ! Thank you bhaiya !

  • @sachinsony9830
    @sachinsony9830 4 місяці тому +1

    hi...memory declaration phase ko hi hoisting khte hai ??

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

    Bhaiya apka js course kafi depth hai kahi kahi hame kuch chije hard lagti hai pr itni achi aur good knowledge Jo intrw time pr kafi important hoti hai ... Voh sab hame abhi hi samjh AA rhi h aur
    Bhaiya Maine js aur bhi channel se study ki hai pr yaha aake Aisa kyu lgta hai ki voh bs hame js project base dikhate h 😂😢
    Itni good knowledge ap hame free mai provide Kara rhe ho thankyou so much sir ❤❤❤
    ❤❤ 😅😊
    And bhaiya mere vs console me voh variable adress search nhi ho rha hai 😢ky Karu Mai ek din bhi kafi preshan ho gya
    Matlb jese apne variable adress search Kiya h vese mere mai variable adress search karne wala option hi nhi AA rha hai bottom side mai 😢 ky Karu btao na bhaiya pls 😢

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

    revision done bhaiya.

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

    Kha gya mahara MDN, Aaja MDN😁😁, Love you bhai yrrr mja aa gya aapse pdne me to

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

      Awesome, keep learning and growing 😊

  • @mysightofficial
    @mysightofficial 5 місяців тому +6

    anonymous ki spelling bahot khatranaak hoti hai 🤣🤣🤣

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

    Sir us line ko kya bole ge jaha pe code execution ho jata like var a line me to undefined hota hai uske next line me jab jata hai tab exicute hota hai to us next line ko kya bole ge

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

    badhiya video h bhai...but ye code snippet dekho, kya reason h alg alag output ka yha? strict mode disabled h
    var x = "a";
    if (true) {
    x = "b";
    function x() {}
    }
    console.log(x); //ƒ x() {}
    var x = "a";
    if (true) {
    function x() {}
    x = "b";
    }
    console.log(x); // "b"

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

    Very nice sir

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

      Awesome, keep learning and sharing 😊

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

    One doubt sir🤚 Is there no memory execution phase for const or let ?

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

    Hoisting mein var aur functions declaration upar shift hone jaisa appear krte hain pr in reality woh upar shift nhi hote hain. Hoisting mtlb variable can be accessed before it is declared and initialized.

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

    god of js😇

  • @tilak4009
    @tilak4009 8 місяців тому

    Can you give a clear definition of hosting

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

    Again thank you.

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

    itna din ke baad hoisting kya hai wo samaj mein aya hein.

  • @User-student-404
    @User-student-404 Місяць тому +1

    day 3 @ vid 35

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

    great

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

    sir Dsa le k ayoo fast

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

    Theory complete

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

    Sir why can't you make it in English 😢 i Regularly watch your interview sessions i gained lots of knowledge from that, But here language barrier 😢

  • @SparshSahani-kj2wy
    @SparshSahani-kj2wy 28 днів тому

    done ep32

  • @oppomobile-ur4jd
    @oppomobile-ur4jd 2 роки тому +1

    💯

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

    ❤❤❤

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

    Immediately invoke function (function {}());

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

    day three

  • @skv7421
    @skv7421 26 днів тому

    Hoisting

  • @Faizan_Iqbal07
    @Faizan_Iqbal07 8 місяців тому