Tag: Javascript

  • [Javascript] Closure

    [Javascript] Closure

    What is a Closure? In simple terms, an inner function captures the context of the outer function. But, what is a context? The context refers to the environment in which a function is declared. This environment includes any variables, parameters, and functions that are within the scope of the function when it is defined. When…

  • [Javascript] Controlling code flow (2)

    [Javascript] Controlling code flow (2)

    Labeled Statement Labeled statements in JavaScript provide a mechanism for identifying and referencing specific statements within your code. While not frequently used, they can be particularly useful in certain scenarios, such as when working with nested loops or when you need to break out of multiple control structures. Why Do We Need Labels? Labels are…

  • [Javascript] Hoisting

    [Javascript] Hoisting

    We already know Hoisting When we write Javascript code, the variables could be used within their scope before they are declared, thanks to hoisting. This feature allows for convenient coding, but it also requires caution as it can lead to unexpected erros and bugs. Javascript hoisting refers to the behavior where variable and function are…