JavaScript Part-5 : JavaScript Data Types

Image

What is meant by JavaScript Data Types?

JavaScript Data Types refers to the type of data that we will use when coding JavaScript. By default JavaScript Language is called a loosely type Language. This means that JavaScript automatically determines the type of data.

How many types of JavaScript Data Type:

JavaScript has two types of Data Type.

  1. Primitives Data Type
  2. Complex Data Type

What is Primitives Data Type in JavaScript?

Primitive Data Type refers to the value of a general data that has no additional property or method. JavaScript supports six types of Primitives Data Type.

  1. Boolean
  2. Number
  3. String
  4. Null
  5. Undefined
  6. Symbol

What is Complex Data Type in JavaScript?

Complex Data Type means that the value of a normal data contains more than one Primitive Data and may have additional Property or Method. JavaScript supports two types of Complex Data Type.

  1. function
  2. object

What is Boolean Data Type in JavaScript?

When any data in JavaScript represents only true (true) or false (false), those data are called Boolean Data in JavaScript.

Image

What is Number Data Type in JavaScript?

In JavaScript, when a data represents only a number, those data are called Number Data Type in JavaScript. In JavaScript, Number can be written in either Decimal or Decimal.

Image

What is String Data Type in JavaScript?

In JavaScript, when a data represents only a string, that is, a series of some characters, those data are called String Data Type in JavaScript. In JavaScript, String Type Data can be written in either single quote (‘’) or Double Quote (””). Also, if there is a number in Single Quote or Double Quote, it is also considered as String Type Data.

Image

What is Null Data Type in JavaScript?

Null in JavaScript means “nothing”. It means something that does not exist. Unfortunately, in JavaScript, Null Data is treated as an Object. Since Null is considered an object in JavaScript, many people consider it a bug. According to them it should be Null.

Image

What is undefined Data Type in JavaScript?

In JavaScript, undefined and null means “nothing”. It means something that does not exist. The difference is that in JavaScript, Null Data is considered as an Object, while undefined Data is considered as undefined as a type.

Image

What is Symbol () Data Type in JavaScript?

Symbol () Data Type in JavaScript is a new type of Primitive Data Type by which we can Unique the value of any Property. Basically, it makes each data a unique key. This is the first Data Type that has no literal location, and it comes first from the ECMAScript 6 (ES6) version.

Image

Examples of JavaScript Object and Function Data type

Image

Leave a Reply

Your email address will not be published. Required fields are marked *