Sunday, March 27, 2022

Javascript - Primitive Data types

 The following is the list of primitive/basic data types in Javascript

  1. Number (which means both integer and floating point type)
  2. String 
  3. Boolean (supports true / false )
  4. undefined
  5. 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