0

What is use of giving constant?? And how is it different from variables and identifiers?

8th Sep 2019, 5:08 AM
Pallavi
5 ответов
+ 2
Const indicates 'read only'. If you try to assign a value, compiler will throw error. Where as variables can be read or written.
8th Sep 2019, 5:14 AM
Kuri
Kuri - avatar
+ 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
8th Sep 2019, 7:12 AM
Qudusayo
Qudusayo - avatar
+ 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.
8th Sep 2019, 9:25 AM
Kuri
Kuri - avatar
0
So u mean static initialising is fine but dynamic initialising is not there
8th Sep 2019, 5:16 AM
Pallavi
0
Thank you!!
8th Sep 2019, 7:15 AM
Pallavi