JavaScript, Functional Programming, Web Development, State Encapsulation, Javascript State.
case, anyone (or any part of the program) can set x.myVal to anything. The next time that myVal is something you didn’t expect, it’s not so easy to figure out where, when, and how it was changed. If you had private fields, however, you can have control over the behaviour of setting the variable via