DEV Community

Cover image for Javascript variables and data types
Esraa Refaat
Esraa Refaat

Posted on

Javascript variables and data types

Variable: containers that hold values
var x = 10 ;
var x is variable
10 is value
variable is loosely typed
Js data types are :
1-undefined
2-number
3-string
4-boolean
5-null
Any variable has undefined data type as initial value until you assign value to it

You can know the type of the variable by using typeof
console.log(typeof x)

Top comments (0)