TC39 proposal: Record and Tuples, the real immutable data structures in JavaScript.
![const record = #{ prop: 1}; const tuple = #[1, 2, 3]](https://miro.medium.com/max/1400/1*BqL1KyRs3tp5G8ski8i6AQ.png)
One of the misleading use cases for beginners in JavaScript is to create constant arrays and objects. With the introductions of ES6, we got two new declarators: let
, for mutable variables, and const
, for constants. Many beginners believe that this will make their objects and array immutable, to discover later that they are not. The object or array…