filmov
tv
Javascript confusion with function declarations
![preview_player](https://i.ytimg.com/vi/EK0H5OArhbo/maxresdefault.jpg)
Показать описание
You have function expression and function declaration.
Although they will behave almost exactly the same in most cases, one of the differences is that if you try to call a function from a function expression before it’s created, you will get an error.
The reason behind it is that function expression gets created only when that line in code is reached.
And function declaration will be executed without any issue due to hoisting.
👉 Linkedin:
👉 Portfolio:
👉 Twitter:
Although they will behave almost exactly the same in most cases, one of the differences is that if you try to call a function from a function expression before it’s created, you will get an error.
The reason behind it is that function expression gets created only when that line in code is reached.
And function declaration will be executed without any issue due to hoisting.
👉 Linkedin:
👉 Portfolio:
👉 Twitter: