Execution context and Call Stack

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024
  • So far, we have a conceptual overview of what happens in the JavaScript engine once we run our JavaScript code and how it is parsed and translated into machine code. Now, let’s understand the order in which the JavaScript code is executed.
    We have learned that JavaScript code is executed inside JavaScript engine’s call stack. A call stack consists of execution contexts. So, what is execution context?
    What is Execution Context?
    Execution context is an abstract concept. But we can say that an execution context is an environment inside which a piece of JavaScript code gets executed. It’s like a box or a container that stores all the necessary information like local variables, arguments etc. for a piece of code to be executed.

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

  • @offgridvince
    @offgridvince Год назад +2

    This content is amazing! This is exactly what I was looking for. Thank you. I'm only 2 minutes into the video, and I had to pause it to make this comment.

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

    Great tutorial....Really enjoyed this javascript execution context

  • @JimmyKama
    @JimmyKama Год назад

    Wow! Thank you very much for such a nice and clear presentation which is quite easier to understand for beginners like me. I was a lot confused with the course I took currently, that's why, I look around and found yours as the best explanation so far.👍👍👍

  • @WeskerUmbrella4
    @WeskerUmbrella4 2 года назад +5

    Ah, so this is where the supposed solution to Global Execution Context being removed from the Stack is.
    Why do so many guides to advanced JavaScript refer to the Stack that still has GEC on it "empty"?
    That was always the confusing part to me as popping off the GEC from the Stack means that the script (program) has finished executing completely. And when you also understand that callbacks run after all functions have been popped off the Stack first, how can any function that also relies on global variables even execute afterwards without any errors, if the variables have been *garbage collected* from the Memory Heap?
    So in such guides, this was always the part not being explained properly - *how* and *where* does JavaScript keep values if GEC gets removed from the Stack and with it, removes all references to variables? How does this mystical code even work as asynchronous, if the variables or other values that were being stored in its memory, *get deleted* after GEC gets removed from the Stack?
    And the simple answer to this question:
    GEC *DOES NOT* get popped off the Stack as long as the Tab it runs in (environment) remains open.

    • @Behold-the-Florist
      @Behold-the-Florist Год назад

      If the asynchronous callback has closure over any variables, even if the callstack is empty and the callback is yet to be queued for execution the variables will remain in memory until they are unreachable.

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

    amazing content!

  • @umerfarooq4026
    @umerfarooq4026 3 года назад

    thanks sir.. but i wanna one question .I have seen var self = this in some function .. kindly can you describe this topic .I will be very thankful to you

    • @procademy
      @procademy  3 года назад +1

      Hi Farooq. Yes, in next few lectures I will explain this topic in detail.

  • @paxis2
    @paxis2 Год назад

    Hello would you kindly share your slides?
    It would be so helpful for learning thank you!

  • @AJAY-hy1ju
    @AJAY-hy1ju 8 месяцев назад

    best bro thank you!

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

    ver ver y goos sir.

  • @elgizhasanzada
    @elgizhasanzada Год назад

    Woow