The most fundamental characteristic of any programming language is the data types it supports..Basically data types refers to the types of values which can be represented and manipulated in that programming language.. Every Programming language has its own set of data types...

JavaScript has three primitive data types:

  1. Numbers: It holds the numerical values e.g:  123, 100.50 
  2. Strings: It holds the piece of text...It can be of 1 character or more than it. eg:  "c" , "This is the text" , "    ddd". 
  3. Boolean : this datatype has only two possible value...true or false..i.e 1 or 0.

Besides these three primitive datatypes. JavaScript also has two trivial data types which are null and undefined and each of them defines only a single value....JavaScript also supports composite data types which are known as object.

 

Variable Initialization:

In JavaScript you can initiate the variables any time. You can initialize them in the beginning of a JavaScript file or you can also create and initialize them anywhere in the document when you need them. Assigning or storing a value to a variable is called variable initialization.

 

The one of the most amazing thing about JavaScript is that its variable can hold any type of value. Unlike C++, Java or many other programming languages, you don't have to mention the type of value you gonna be store in that variable..JavaScript will take care automatically..

 

Variable Declaration: 

In JavaScript you can define any type of variable simply using keyword var  and the JavaScript automatically do the rest. To enhance the JavaScript ES2015 has two more keywords to declare a variable. const and let are used to define the constant variable and block scope variable respectively..You can change the value of a const variable once you initialized it and let is used to define the variables in a block scope variable...

Let's See an Example: