Explanation: Object.freeze() prevents adding, removing, or modifying properties.
Dear candidates you will find MCQ questions of JavaScript here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
Explanation: Object.freeze() prevents adding, removing, or modifying properties.
let a = [1,2,3]; a.length = 0; console.log(a);
Explanation: Setting length = 0 clears the array.
Explanation: The try...catch statement is used to handle errors.
let x = [1,2,3]; console.log(x instanceof Array);
Explanation: Array is the constructor for arrays, so instanceof returns true.
Explanation: Spread syntax expands elements of iterable objects like arrays or objects.
let name = 'John';
console.log(`Hello ${name}`);
Explanation: Template literals use ${} to interpolate variables.
Explanation: Object.keys(obj) returns an array of a given object's keys.