0
What is use of giving constant?? And how is it different from variables and identifiers?
5 Respostas
+ 2
Const indicates 'read only'. If you try to assign a value, compiler will throw error.
Where as variables can be read or written.
+ 2
Constant (const) is just assigning a constant variable that is not to be changed
But var can change and also let but const can't change you can use const with objects and arrays because you don't change them but assigning more values to them
+ 1
If you put in a const keyword to a variable, then you shall initialize that variable at the same place.. If you try to modify then you will get compilation error.
0
So u mean static initialising is fine but dynamic initialising is not there
0
Thank you!!