Bubble Foundry

Posts tagged with: immutability

Immutable Javascript
Something I quickly whipped up the other day, which you can find on GitHub as a Gist. Wish you had some immutability in Javascript? Now you can! var t = {a: 1, b: 2}.immutable(); console.log(t.a, t.b); try { t.a = 3; // -> Uncaught Error: a is immutable and cannot be modified. } catch (e) […] Read more – ‘Immutable Javascript’.
Javascript Primitives
From the Mozilla Javascript Glossary: primitive, primitive value A data that is not an object and does not have any methods. JavaScript has 5 primitive datatypes: string, number, boolean, null, undefined. With the exception of null and undefined, all primitives values have object equivalents which wrap around the primitive values, e.g. a String object wraps […] Read more – ‘Javascript Primitives’.