You are on page 1of 2

datatypes supported by javascript:

----------------------------------
1.number--it can store numeric data 2^53-1
2.bigint--it can store numeric data > 2^53-1,the value should be
suffixed with n
eg:
var price=10000; -->number datatype
var price=10000n; -->bigint datatype
3.string--it can store char (or) chars
4.boolean--it can store true|false
5.undefined--it can store null|undefined,this will be applied to
a variable without initialization
eg:
var a; -->undefined datatype

*javascript is providing 3 keywords for variable declaration


1.let--this allows block level variable declaration
2.var--this allows function level variable declaration
3.const--this allows block level constant variable declaration,the value is fixed

es6 is providing let and const

*variable declaration syntax:


let|var|const <varname>;

*javascript is loosely and dynamic typed language,javascript will


assign datatype to a variable automatically based on value

eg:
var a=100; --> datatype applied is number
..
a="xyz"; --> datatype applied is string

You might also like