- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Variable Hoisting in JavaScript
When you can use a JavaScript variable before it is declared, it is done using a technique called hoisting. The parser read through the complete function before running it.
The behavior in which a variable appears to be used before it is declared is known as hoisting −
For example, the following,
points =200; var points;
The above works the same like the following −
var points; ponts = 200;
- Related Articles
- Explain hoisting in JavaScript
- Assigning function to variable in JavaScript?
- What is Variable Shadowing in JavaScript?
- What are Variable Naming Conventions in JavaScript
- Can re-declaring a variable destroy the value of that variable in JavaScript?
- Variable collection name in MongoDB shell with JavaScript?
- How to check for “undefined” variable in JavaScript?
- Various ways to define a variable in JavaScript
- How does JavaScript Variable Scope work?
- How to unset a JavaScript variable?
- JavaScript - Set object key by variable
- How to define global variable in a JavaScript function?
- How to check if a variable exists in JavaScript?
- How to check a not-defined variable in JavaScript?
- How to display JavaScript variable value in alert box?

Advertisements