How do you add a new property gender with value male to the person object?
A). person.gender = 'male';
B). person.gender = male;
C). person.gender = ['male'];
D). person[gender] = 'male';
How can you delete the age property from the person object?
A). delete person.age;
B). remove person.age;
C). person.age = null;
D). person.age.delete;
How can you check if the age property exists in the person object?
A). 'age' in person
B). person.has('age')
C). person.contains('age')
D). person.hasOwnProperty('age')
How do you define a class in JavaScript ES6?
A). class ClassName { constructor() {} }
B). function ClassName() { constructor() {} }
C). class ClassName() { constructor {} }
D). function class ClassName { constructor() {} }
What will the following code output? console.log(person['age']); if var person = {name: 'John'};
A). 30
B). John
C). undefined
D). null
What is the output of console.log(person.greet()); if var person = {greet: function() {return 'Hello';}};?
A). Hello
B). Undefined
C). Error
D). Hello
How do you define a method inside a class in JavaScript ES6?
A). methodName() {}
B). this.methodName = function() {}
C). function methodName() {}
D). methodName: function() {}
What will console.log(car.make); output if var car = {make: 'Toyota', model: 'Corolla'};?
A). Toyota
B). Corolla
C). Undefined
D). Error
What is the correct way to create an object in JavaScript?
A). var obj = {};
B). var obj = [];
C). var obj = ();
D). var obj = {};
How do you create an instance of the Car object using the constructor function?
A). var myCar = new Car('Toyota', 'Corolla');
B). var myCar = Car('Toyota', 'Corolla');
C). var myCar = create Car('Toyota', 'Corolla');
D). var myCar = construct Car('Toyota', 'Corolla');