Question: What would the output of the following code be: function sum() { return this.a + this.b + this.c; } var o = {a: 3,b: 4,c:
What would the output of the following code be:
function sum() { return this.a + this.b + this.c; } var o = {a: 3,b: 4,c: 5,
get average() { return (this.a + this.b + this.c) / 3; } }; Object.defineProperty(o, 'sum', {get: sum, enumerable: true, configurable: true}); console.log(o.average, o.sum);
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
