JavaScript Data Types Documentation
1. Introduction
Welcome to the documentation for JavaScript Data Types. This section provides an overview of Data Types and their functionality.
2. String
A sequence of characters used to represent text. Enclosed in single or double quotes.
const
greeting: string
= 'Hello, World!'
;
3. Number
Represents numeric values, including integers and floating-point numbers.
const
age: number
= 25
;
4. Boolean
Represents a logical value - either true or false.
const
isTrue: boolean
= true
;
5. Undefined
Indicates that a variable has been declared but has not been assigned a value.
let
undefinedVar: undefined
;
6. Null
Represents the intentional absence of any object value.
const
nullVar: null
= null
;
7. Object
Represents a collection of key-value pairs. Can include properties and methods.
const
person: { name: string
, age: number
} = { name: 'John'
, age: 30
};
8. Array
An ordered list of values, where each value is identified by an index or a key.
const
numbers: number
[] = [1
, 2
, 3
, 4
, 5
];
9. Date
Represents a specific point in time, typically with year, month, day, hour, minute, second, and millisecond components.
const
currentDate: Date
= new
Date
();