Photo by Sean Lim on Unsplash

Basically in JavaScript there are two types of data . They are

1. Primitive Data Type

2. Non-primitive Data Type/ Reference Data Type

Primitive Data Types: We know everything in JavaScript is object. But primitive data types are not object or functions. Primitive data types stores values directly. This data types can be numbers, strings or among other things.


Primitive Data Types

There are 7 Primitive data types. They are : -

· Undefined: When you declare variable but don’t store value any value. This used for unintentionally missing values.

· null : This have no existence but not it’s not undefined .It’s used for intentionally missing values.

· number: It’s used for math calculation. It can be normal number, decimal numbers or even negative numbers.

· string : used for text .

· Boolean: It’s used for logical operator . It’s values are true and false.

· Symbols: used to hide implementation details.

· Bigint: used for big numbers for math.

Non Primitive Data Types: Non primitive data types don’t store values directly. They store values as references. These types of values are objects. Here are different types of data types –

· Object: used to group related data.

· Array: used for collect a group of data.

· Function: used to refer to code.


Non Primitive Data Types

Expressions: An expression is a snippet of code that can be evaluate to a value. The value may be a number, a string, or a logical value.


JavaScript Expressions

JavaScript has 3 kinds of variables. They are:

· Arithmetic expression: It’s evaluates to a number.

· String expression: It’s evaluates to character string.

· Logical expression: It’s evaluates to true or false.

Checking a Type: In JavaScript every values looks same but has different types. If you want to check the type of values it’ll return the type as string, number, Boolean, null, undefined, object, function.


Front End Engineer | JavaScript Developer