Which of the following is true about const in JavaScript?

Which of the following is true about const in JavaScript?

a) A variable declared with const cannot be reassigned
b) A variable declared with const is block-scoped
c) The value of a const variable can be an object or array
d) 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.

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Scroll to Top