Q
What does Object.assign(target, ...sources) do?

Answer & Solution

Answer: Option A
Solution:
Object.assign(target, ...sources) copies properties from one or more source objects to a target object.
Related Questions on Average

How can you iterate over all properties of an object?

A). for (var key of object)

B). for (var key in object)

C). for (var key with object)

D). for (var key over object)

What is the output of car.start() if var car = {start: function() {console.log('Car started');}};?

A). Car

B). started

C). Car started

D). Error

How do you define a method in a constructor function?

A). this.methodName = function() {}

B). this.methodName: function() {}

C). this.methodName = () {}

D). this.methodName: () {}

What is the purpose of the this keyword in an object method?

A). It refers to the global object.

B). It refers to the current object.

C). It refers to the parent object.

D). It refers to the previous object.

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() {} }

How do you define a method inside a class in JavaScript ES6?

A). methodName() {}

B). this.methodName = function() {}

C). function methodName() {}

D). methodName: function() {}

How do you define a constructor function for a Car object?

A). function Car(make, model, year) { this.make = make; this.model = model; this.year = year; }

B). Car(make, model, year) { this.make = make; this.model = model; this.year = year; }

C). function create Car(make, model, year) { this.make = make; this.model = model; this.year = year; }

D). function construct Car(make, model, year) { this.make = make; this.model = model; this.year = year; }

What does Object.keys(obj) return?

A). An array of the values of the object's properties

B). An array of the names of the object's properties

C). The first key of the object

D). The number of properties in the object

Which method can be used to call a function defined within an object?

A). object.functionName();

B). object->functionName();

C). object::functionName();

D). object.callFunction('functionName');

How do you create a method inside an object using an object literal?

A). methodName: function() {}

B). methodName = function() {}

C). methodName: () {}

D). methodName: method() {}