It is simply record in the memory and each record has specific type and all value types in JavaScript are divided into two groups: primitive value types or reference.
Primitive Values
Number: Represents numeric values, such as 10, 10.12
String: Represents a sequence of characters, enclosed in single or double quotes, such as “Hello” or “JavaScript”
Boolean: Represents logical values ‘true’ or ‘false’Undefined: Represents a variable that has been declared but not assigned a value
Null: Represents the intentional absence of any object value
Symbol: Represents a unique and immutable value used as an identifier
let age = 52; // Number
let name = "abc"; // String
let isWorking = true; // Boolean
let data = undefined; // Undefined
let n = null; // Null
let id = Symbole("Unique"); // Symbol
Non-Primitive Values (reference)
Object: Represents a collection of key – value pairs, created using object literals ‘{}’ or constructor functions
Array: Represents an ordered collection of elements, created using square brackets ‘[ ]’
Function: Represents a block of reusable code that can be invoked by its nameDate: Represents a specific date and time
RegExp: Represents a regular expression for matching patterns in strings
Error: Represents an error object thrown during the execution of code
let person = {name:"ABC", age:25}; // object
let marks = [50, 76, 90]; // Array
let gr = function() {console.log{"Hello!"};}; //Function
let today = new Date(); // Date
let pattern = /abc/;
let error = new Error("No Internet"); // Error
Views: 15