Hoisting in Javascript

Hoisting is a phenomenon in javascript by which you can access variables and functions even before you initialize them. You can access it without any error.

In the below diagram, you can find that you can call getMe() and variable d before initializing it.

In the case of the arrow function, it will throw an error because getMe will behave just like a variable and it is undefined in the global execution memory phase.

Error
Error