InterviewSolution
| 1. |
What Is Javascript Hoisted? |
|
Answer» In the JAVASCRIPT, the variables can be used before declared, this kinds of mechanism is called Hoisted. It's a default behavior of JavaScript. You can EASILY understanding in the below example in detail. //The variable declaration LOOK like. var emp; //The declaration of a different variable name emp is hoisted but the value of emp is undefined. console.log(emp); //The output is undefined In the JavaScript, the variables can be used before declared, this kinds of mechanism is called Hoisted. It's a default behavior of JavaScript. You can easily understanding in the below example in detail. //The variable declaration look like. var emp; //The declaration of a different variable name emp is hoisted but the value of emp is undefined. console.log(emp); //The output is undefined |
|