javascript - How to return a constructor argument value from a getter function in ES6 Classes -
example:
class person { constructor(name) { } name() { return /* “name” argument constructor */; } }
i name
getter returns name
value passed in constructor.
save argument instance property:
class person { constructor(name) { this.name_ = name; } name() { return this.name_; } }
Comments
Post a Comment