In computer science there is a concept called Immutability. If you create an immutable object, once it’s created you aren’t allowed to change it anymore. This includes adding, modifying, or deleting a properties. For very simple situations, this concept isn’t used a lot. However, if you start writing complex applications or even games, it comes in handy.

The following article covers the benefits of immutability in JavaScript and how you can implement it. The article also includes a live demo so that you can play with this concept:

http://www.sitepoint.com/immutability-javascript/

Trick of the day: Immutability in JavaScript
Tagged on: