3 ms·
Ugh, you're kidding? EDIT: checked in Node, yep. That's unfortunate. Can we get a let foo immutable = [1]; or something? EDIT2: Although this can be implement
by MatthewPhillips 13y ago
Ugh, you're kidding?
EDIT: checked in Node, yep. That's unfortunate. Can we get a let foo immutable = [1]; or something?
EDIT2: Although this can be implemented in user-land with Object.freeze. Create a function that returns a const that is frozen if it is non-primitive. That should cover it, right?
- kevingadd 13y agofreeze/seal don't actually provide true immutability in JS. There are cases where a frozen object can still be modified (Date is one of them, IIRC typed arrays are another)