Undefined Questions


This might not make any sense but why are you only able to make an undefined variable using let, and not const?


good question actually.

constant variables can’t be changed:

const x = 'initial value'
x = 'attempting to re-assign, will given an error'

so declaring variables with const and giving it no value would be pointless, we can’t change constant variable later. let variable can be re-assigned, which is possible to give them no value in the beginning.


I see. Thanks for answering my odd question!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.