In this exercise, you’ll refactor some ES5 code into ES2015.
const PI = 3.14
const PI = 3.14
PI = 42
-
What is the difference between var and let?
- var create variable under the window scope,let create variable only under block-scoped
- var also hosting the variable
-
What is the difference between var and const?
- var create variable under the window scope,const create variable only under block-scoped
- var allow to reassign the variable,const not allow to reassign the variable
- var also hosting the variable
-
What is the difference between let and const?
- let allow to reassign variable value const don't allow
-
What is hoisting?
- hosting means variable that define on top of the document.
- variable hoisted to the top of the scopes when they are declare in.