MCQ
Single Best Answer
Not Set
QWhich type of variable among the following is volatile?
ID: #4830
Python Basic MCQ
188 views
Question Info
#4830Q ID
Not SetDifficulty
Python Basic MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option A
Explanation
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.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic