DEV Community

loading...
Cover image for Javascript variables and data types

Javascript variables and data types

Esraa
・1 min read

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)

Discussion (0)