PrepAway - Latest Free Exam Questions & Answers

You are creating a JavaScript object that represents an employee.

You are creating a JavaScript object that represents an employee.

You need to extend the Employee object by adding the GetPayroll() method.

You need to ensure that all future instances of the Employee object implement the GetPayroll() method.

Which code segment should you use?



A. Option A

B. Option B

C. Option C

D. Option D

Explanation:

* Object.prototype.constructor

Returns a reference to the Objectfunction that created the instances prototype. Note that the value of this property is a reference to the function itself, not a string containing the functions name. The value is only read-only for primitive values such as 1, true and -test-.

* The constructor property is created together with the function as a single property of func.prototype.

Reference: Object.prototype.constructor


Leave a Reply