Marwan
02/10/2022, 6:36 AMconst
and let
, I thought NS doesn't accept anything after ES5Dmitry Masanov
02/10/2022, 6:49 AMMarwan
02/10/2022, 6:50 AMDmitry Masanov
02/10/2022, 6:50 AMMarwan
02/10/2022, 6:51 AMDmitry Masanov
02/10/2022, 6:51 AMlet sublist
I would use const here as wellMarwan
02/10/2022, 6:54 AMMike Robbins
02/10/2022, 2:06 PMconst
for things that cannot change and let
for things that can change. The distinction being that we can change something without reassigning the variable which const
prevents.
Technically I can use const
to create an empty array/object and still add elements/properties.
This may not be in the spirit of const
in the minds of some.scottvonduhn
02/10/2022, 3:10 PMlet
for a variable that is never re-assigned, even if that variable is an object or array that you modify later. Our company follows those rules, so we use const
whenever possible, even on mutable objects and arrays.