JavaScript Tutorial
indexjavascript history javascript versions language specificationsarrays built in objects call apply bind classes constructors closures environment setup error handling debugging functions interview questions objects programming constructs prototypes reactangularjsset map strings numbers testing frameworks variables data typesVariables and data types in javascript
Variables
You do not need to declare variables before using them. But it is not good practise. You can force variable declaration using "use strict" statement at the beginning of the script. Variables can be declared using 3 ways var - Variable has function scope and it is hoisted. Variables created without the keyword var have global scope even if they are created inside a function. let - Variable has block scope and it is not hoisted const - similar to Const. Const variables can be assigned only onceVariables Types
You can find the type of any variable using typeof operator. Here is the list of primitive data types- Number
- Bigint
- String
- Boolean
- null
- Undefined
- Symbol
- Objects
- Functions
- Arrays
Complex problems, Simple Solutions