Remix.run Logo
munificent 10 hours ago

> When an immutable value is assigned to a variable, the JavaScript engine creates a copy of that value and stores the copy in memory

Not exactly. The language doesn't specify whether the value is copied or not and, precisely because values are immutable, there's no way for a user to tell if it was or wasn't.

For example, strings are also immutable value types, but you can be certain that no JS engine is fully copying the entire string every time you assign one to a variable or pass it to a parameter.