Day:2 - Data Types in JavaScript

In JavaScript, a Data Type defines the type and behavior of a value. It tells the computer whether a value is text, a number, a true/false condition, or a complex structure. Unlike boxes (variables), data types are the physical things stored inside them.

Data Types:

  1. Numbers:
  2. Strings:
  3. Booleans:
  4. Undefined:
  5. Null:
  6. Objects:
  7. Symbols:
  8. BigInt:

1. The Number Data Type

JavaScript has only one basic numeric type that handles both integers (whole numbers) and floating-point numbers (numbers containing a decimal point).

2. The String Data Type

A String represents textual data. Strings must be cleanly wrapped inside either single quotes ('') or double quotes ("").

3. The Boolean Data Type

A Boolean is a logical data type that can only hold one of two explicit values: true or false. Think of it as an on/off switch.

4. The Undefined Data Type

Undefined is a default state. It means a variable container has been declared and built, but nobody has put a value inside it yet.

5. The Null Data Type

Null is an intentional assignment that represents empty space, "nothing," or a completely blank state initialized by choice.

6. The Symbol Data Type

Symbols generate completely unique, hidden, and immutable (unchangeable) identifiers. Even if two symbols share the same description label, they remain completely distinct properties inside memory.

7. The BigInt Data Type

BigInt handles massive integers that exceed the safe calculation limits of the normal Number data type. They are built by adding an 'n' to the end of a whole number block.

8. The Object Data Type

An Object is a non-primitive data type. It is a structured collection of related data stored in Key-Value property patterns to describe complex items.