Member-only story
In JavaScript, there are several data types that are used to store and manipulate data. Here’s a tutorial on the different types of data types in JavaScript:
Not a Medium member? Read this article here
- Numbers
let num = 5;
The number data type is used to store numeric values. It can be a positive, negative, or decimal number.
2. Strings:
let str = "Hello, World!";
The string data type is used to store text. It’s created by enclosing text in quotation marks (either single or double).
3. Booleans:
let bool = true;
The boolean data type is used to store true/false values. It’s often used in conditional statements.
4. Undefined:
let undefinedVariable;
The undefined data type is used to represent a variable that has not been assigned a value.
5. Null:
let nullVariable = null;
The null data type is used to represent a deliberate non-value.
6. Objects:
let obj = { name: "John", age: 30 };