var myvariable = 1; // numeric value myvariable = 'one'; // string value myvariable = 1.1; // decimal value myvariable = true; // Boolean value myvariable = null; // null value
true are examples of different data types.
Primitive Data Types
|String||String is a textual content wrapped inside
Example: 'Hello World!', "This is a string", etc.
|Number||Number is a numeric value.
Example: 100, 4521983, etc.
|BigInt||BigInt is a numeric value in the arbitrary precision format.
Example: 453889879865131n, 200n, etc.
|Boolean||Boolean is a logical data type that has only two values, true or false.|
|Null||A null value denotes an absense of value.
|Undefined||undefined is the default value of a variable that has not been assigned any value.
Example: In the variable declaration,
Structural Data Types
The structural data types contain some kind of structure with primitive data.
|Object||An object holds multiple values in terms of properties and methods.
|Date||Date object represents date & time including days, months, years, hours, minutes, seconds and milliseconds.
|Array||An array stores multiple values using special syntax.
Learn about each data type in detail in the next section.