How do you inherit properties and methods from another class in JavaScript ES6?
A). class SubClass extends SuperClass {}
B). class SubClass inherits SuperClass {}
C). class SubClass implements SuperClass {}
D). class SubClass super SuperClass {}
How do you define a method named greet in an object var person = {};?
A). person.greet = function() {};
B). person.greet: function() {};
C). person.greet = () {};
D). person.greet = function {};
How do you access the value of the name property in the object var person = {name: 'John', age: 30};?
A). person['name']
B). person.name
C). person->name
D). person::name
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';
What is the output of console.log(person.greet()); if var person = {greet: function() {return 'Hello';}};?
A). Hello
B). Undefined
C). Error
D). Hello
What is the purpose of the this keyword in a constructor function?
A). It refers to the new object being created.
B). It refers to the global object.
C). It refers to the current object.
D). It refers to the parent object.
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');
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;
What does Object.keys(person) return if var person = {name: 'John', age: 30};?
A). ['name', 'age']
B). ['John', 30]
C). {'name', 'age'}
D). {'John', 30}
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() {} }