News for hackers. Stuff that matters.
Re:Overview of JavaScript ES6 features by Tankenstein on Monday October 24, 2016 @09:40AM (#12778633)
Common misconception, const only disallows reassignment. For instance,

const number = 1337;

number = 10; // fails

But objects/arrays are not immutable in js, so you can do this:

const person = { name: 'Dude' };

person.name = 'Dudette';

Which is perfectly valid. If you want full immutability, i recommend you check out https://facebook.github.io/immutable-js/, been running it in production, a real pleasure to work with.

Re:Overview of JavaScript ES6 features by jasoncchild on Monday October 24, 2016 @09:56AM (#12778780)
FWIW Immutable.js is not deeply immutable. Seamless-immutable however is.
Re:Overview of JavaScript ES6 features by masklinn on Monday October 24, 2016 @10:24AM (#12779029)
> Seamless-immutable however is.

Only in development mode, by freezing the objects.

Re:Overview of JavaScript ES6 features by Roboprog on Monday October 24, 2016 @12:28PM (#12780307)
Any popular "deep freeze" utilities around?
Re:Overview of JavaScript ES6 features by pitaj on Monday October 24, 2016 @02:08PM (#12781236)

    function deepFreeze(obj) {
      const out = Object.freeze(obj);
      Object.keys(out).forEach(key => {
        if (typeof out[key] === 'object') {
          out[key] = Object.freeze(out[key]);
        }
      });
      return out;
    }
Re:Overview of JavaScript ES6 features by Roboprog on Monday October 24, 2016 @08:22PM (#12784128)
I think you meant "out[ key ] = deepFreeze( out[ key ] )" in the innermost step :-)

(recursive)