- A Mutable variable
- B Dynamic variable
- C Volatile variable
- D Immutable variable
- Share this MCQ
Answer:
A
Share this MCQ
In JavaScript, only arrays and objects are mutable, which means that their values can be modified after they are created.
Primitive values such as numbers, strings, and booleans are immutable, which means that their values cannot be changed once they are created.
For example:
let a = [1, 2, 3];
a.push(4); // okay, a is now [1, 2, 3, 4]
let b = { x: 10, y: 20 };
b.x = 30; // okay, b is now { x: 30, y: 20 }
In this example, the a array and the b object are both mutable, and their values can be modified by adding or modifying elements in the array or properties in the object.
Share this MCQ