Skip to main content

Hoisting For (let, const, var)

let and const are hoisted to the top of the block they
are in but not initialized to the default undefined value so
we can not use them until they are declared.
If we do,RerefenceError is thrown.

Variables declared using var can be accessed before they are declared and are equal to undefined.

Remember hoisting means declarations are moved to the top of their scope not the initialization.

What is $(This) keyword in Node Enviornment

The things i need to remember:

In a normal function / function declaration / named function, “this” keyword refers to the object that the function is called

Arrow functions do not have their own bindings, so when “this” is accesses inside an arrow function, it is taken from outside.

when “this” keyword is used in a named function/function declaration, the “this” keyword is equal to the global object as long as the named function is in the global scope and not called on any object.

In the global scope the “this” keyword refers to module.exports object.

In a function expresson in the gloabal scope this keyword reffers to module.exports object.