Skip to main content
11 events
when toggle format what by license comment
Jan 9, 2019 at 21:57 comment added Emile Bergeron "using const for all non-array/non-objects and use let for objects/arrays" This just opens you up to a broader range of problems...
Oct 12, 2016 at 20:24 comment added monokrome Nobody said they weren't immutable, though. It's a common misunderstanding that the goal of const is to make it immutable, when it's really to guarantee that the name won't ever reference a different object than the one it was initialized to.
S Jul 25, 2016 at 9:10 history suggested rgripper CC BY-SA 3.0
clarified what is mutable and updated quote from the source
Jul 25, 2016 at 5:34 review Suggested edits
S Jul 25, 2016 at 9:10
Feb 17, 2016 at 22:57 comment added MaxWell +1 Yeah, the reference is protected, but in terms of the question, it's pretty silly to use in cases like, const moment = require('moment'), unless you're the type of person who's worried that someone will try to do moment = dead.fish(() => pizza) later.
Dec 24, 2015 at 1:33 comment added Gaston Sanchez Misleading. It is inmutable. But the actual object properties are not.
Oct 13, 2015 at 9:43 comment added Josef Engelfrost True, but expected IMO - what is constant is the object reference assigned to your const. colors = numbers won't work, as expected. If you want to protect your object properties you can use Object.freeze() developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
Jul 23, 2015 at 13:17 history edited lax4mike CC BY-SA 3.0
minor clarity edit
Jul 22, 2015 at 20:12 history edited lax4mike CC BY-SA 3.0
added 3 characters in body
Jul 22, 2015 at 20:05 review First posts
Jul 23, 2015 at 10:11
Jul 22, 2015 at 20:03 history answered lax4mike CC BY-SA 3.0