Memory

Memory is the brain’s ability to encode, store, and retrieve information, allowing us to learn, adapt, and recall past experiences.

Types of Memory

Memory is categorized into two types:

Stack Memory (Primitive)

Used for storing fixed-size data like numbers, booleans, and references.

Stack Memory

Heap Memory (Non-Primitive)

Used for storing dynamic data like objects, arrays, and functions.

Heap Memory

Characteristics of Heap Memory:

Example:

let person = {
  name: "John",
  age: 30,
};

let numbers = [1, 2, 3, 4, 5];

function greet() {
  console.log("Hello, World!");
}