Which of the following is true about const in JavaScript?
a) A variable declared with
const cannot be reassignedb) A variable declared with
const is block-scopedc) The value of a
const variable can be an object or arrayd) All of the above
Answer:
d) All of the above
Explanation:
Variables declared with const are block-scoped, meaning they are limited to the scope of the block in which they are defined. They cannot be reassigned, but if the value is an object or array, you can still modify the properties of the object or the elements of the array.