JavaScript Data Types

 JavaScript Data Types

Following are the javascript data type :
            String, Number, Boolean, Array, Object.

Example:

Number
var length = 10;            

String                                      
var Name = "Soma";    

Array                                    
var country = ["India", "China", "USA"];    

 
Object / JSON   
var name = {firstName:"Nikita", lastName:"Camon"};  



Undefined data type or Value
A variable without a value, has the value undefined.
var person;
person = undefined;     // undefined  value

Null 
In JavaScript null is "nothing". the data type of null is an object.
var person = null;

Difference Between Undefined and Null
typeof undefined            // undefined
typeof null                      // object
null === undefined         // false
null == undefined           // true


adding a number and a string, JavaScript will treat as a string.
var x = 160+ "ova";   ->  "160ova"
or
var x = "ova"+10;        ->  "ova10"

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation