r/javascript • • Oct 24 '16

help The only thing I hate about const ...

... is that it is 5 chars long.

For some reason, let with its 3 chars, looks more elegant.

7 Upvotes

49 comments sorted by

View all comments

7

u/[deleted] Oct 24 '16

Somehow I find myself agreeing with you...

4

u/ebilgenius Oct 25 '16
let agree = true;

22

u/snoee Oct 25 '16

agree = false;

Sucker, shoulda used const!

5

u/inu-no-policemen Oct 25 '16

For opinions? Certainly not. You should always reevaluate your stance whenever new information becomes available.

6

u/[deleted] Oct 25 '16

Still possible if your brain uses uses redux:

const agreeReducer = (opinion = { agree: true }, thought) => {
    const nextOpinion = Object.assign({}, opinion);

    if (thought.action === 'CHANGE_MIND') {
        nextOpinion.agree = !nextOpinion.agree;
    }
    
    return nextOpinion;
}

With the added benefit of being able to change opinions in a well-informed manner because you are able to keep perfect track of prior reasoning.