PrepAway - Latest Free Exam Questions & Answers

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 theCustomer object implement the GetCommission() method.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

5 Comments on “Which code segment should you use?

  1. JNash says:

    I think there’s something wrong with that question. Every answer has on the left side “.GetCommission() = ” which is a method invocation and assignment is invalid. That cause a error “Customer.prototype.GetCommission is not a function”. Right answer should be without parentheses.




    0



    0
  2. cindy lou says:

    The prototype property allows you to add new properties and methods to existing object types. for example,

    function PrintStuff (myDocuments) {
    ​this.documents = myDocuments;
    PrintStuff.prototype.print = function () {
    console.log(this.documents);




    0



    0

Leave a Reply