Which code segment should you use?

You are creating a JavaScript object that represents a customer.
You need to extend the Customer object by adding the GetCommission() method.
You need to ensure that all future instances of the Customer object implement the GetCommission() method.
Which code segment should you use?

You are creating a JavaScript object that represents a customer.
You need to extend the Customer object by adding the GetCommission() method.
You need to ensure that all future instances of the Customer object implement the GetCommission() method.
Which code segment should you use?

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 4

Your email address will not be published. Required fields are marked *


Wayne

Wayne

The answer should not have () at the end of function name.

Customer.prototype.GetCommission = function(){
//code
}

SOUMAIRI

SOUMAIRI

the answer is right

Firefox360

Firefox360

The answer approaches the right answer the most, see Wayne’s Response 😉 But yeah, for the exam D will be the correct answer.