Data types in Javascript |Primitive Data types in Javascript

Data types in Javascript are as follow:

Data types in Javascript
  1. Numbers

  2. String

  3. Boolean

  4. Null

  5. undefined 



 1.Number 

In Javascript, the number datatype holds integer value it may or may not be in the fractional part. the number can represent any integer number or floating number also we can perform some mathematical operations on Number datatypes like Multiplication, Addition, Subtraction, Division and, many more.
Syntax:  let varible_name=value;
Example: 
let a=1;
a=1.1;

2.String

String in Javascript can be any alphabet character surrounded by single or double-quotes. In programming languages, the standard definition of String is "String is a collection of characters". Similarly in Javascript too.
Syntax: let variable_name=string_value;
Example
let s="Shivam";
et s1='I Love Coding';

3.Boolean

Boolean is a part of primitive Datatypes in Javascript, Boolean data type has only two values true or false.
Syntax: let varible_name=logical type;
Example
let a= 2>1;
console.log(a);

4.Null

In Javascript, the special null value does not belong to any type of data.it only contains null as a value.
Syntax:  let varible_name=null;
Example:
 let a=null;

5.Undefined

Just like null, The undefined makes a type of own, As the name, suggest it does not contain any value or we can say value not assigned When a variable is declared but the value is not assigned that's mean it is undefined type.
Syntax: let a;
Example: 
let a;

Comments