The following is the list of primitive/basic data types in Javascript
- Number (which means both integer and floating point type)
- String
- Boolean (supports true / false )
- undefined
- null
Javascript supports Dynamic Typing which means the datatype is associated is value rather than variable. Programming languages like C, Java support static typing which means variable is associated with datatype.
Variables in Javascript
They can be defined using let or var keywords as follows:
var age=25;
console.log(age); //25
console.log(typeof age); // prints Number
The typeof operator is used to print the datatype of the value.
No comments:
Post a Comment