Friday, 10 November 2017

What are Different Datatypes in JavaScript

JavaScript is a dynamic typed (or termed as Loosely Typed) scripting language which means that same variable can be assigned data of different types.

Description

Javascript Datatypes:

JavaScript is a dynamic typed (or termed as Loosely Typed) scripting language which means that same variable can be assigned data of different types. JavaScript provides different data types to hold different types of values. There are two types of data types in JavaScript.
Primary Data Types (Primitive)
  1. String
  2. Number
  3. Boolean
Composite Data Types (reference)
  1. Object
  2. Array
  3. Special Data Types
  4. Null
  5. Undefined
String: A strings of any characters enclosed in quotes is a string primitive.
Number: A number by itself is a number primitive, all numbers in JavaScript are 64-bit floating point numbers.
Boolean: It will store Variables or expressions which are either true or false.
Object: A collections of properties and methods. In Javascript, anything that is not a primitive is an Object.
Arrays: Arrays are regular objects, both objects and arrays can have properties and methods.
Null: It has only one value in JavaScript: null.
Undefined: It treated as a variable that has been declared, but has never had a value assigned to it.

READMORE

No comments:

Post a Comment