Understanding Shallow and Deep Copying of Objects in JavaScript
// Assigning a value from a to b
let a = 12;
let b = a;
This method works for primitive types. What happens if a is an object? Let's examine what occurs in memory:
Declaring a = 12 allocates a space in the stack. When a is assigned to b, another space is created in the stack, and b holds the same value as a.
If a is an object, what happens in ...
Posted on Sat, 30 May 2026 21:40:20 +0000 by RootKit