4 ms·
Yeah, this is also true of the `val` statement in Scala too. I suppose though that in Scala, one would probably make all data members of classes `val` as well,
by acjohnson55 12y ago
Yeah, this is also true of the `val` statement in Scala too. I suppose though that in Scala, one would probably make all data members of classes `val` as well, whereas in Javascript, there's no in-line syntax for constant object properties (Object.freeze being a bit verbose to use everywhere).
But even that limited form of enforced immutability is helpful. I personally find it easier to understand a complex function when I can assume that no names are being rebound.