Question: JavaScript ES6 extensions added some familiar syntax to define classes but continued to use the object-oriented programming conventions long-used in JavaScript. The below syntax defines
JavaScript ES6 extensions added some familiar syntax to define classes but continued to use the object-oriented programming conventions long-used in JavaScript. The below syntax defines a JavaScript class (Foo) that has a member property (member_prop) and a member method (member_method). Code allocates an instance of the class Foo into the variable f.
class Foo { static static_prop = 1; constructor() { this.member_prop = 2; } member_method() { console.log("member method call"); } } let f = new Foo();
(a) Show the JavaScript expression that would add one to member_prop. (b) Show the JavaScript expression that would add two to static_prop.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
