9

Whether an object is declared const or let in ES2015 doesn't affect assignment to its properties:

> let a = {}
undefined
> const b = {}
undefined
> a.y = 3
3
> b.y = 3
3
> a
{ y: 3 }
> b
{ y: 3 }

Is there a good reason to prefer one form of declaration over the other?

Steve Bennett
  • 114,604
  • 39
  • 168
  • 219

0 Answers0