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?
freeze/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)
reply