Article From:https://segmentfault.com/q/1010000011705181
Question:
const obj = {a: 1}
Object.defineProperty(obj, 'a', {
  get() {
    // Here how to return to your own value without the Maximum call error.Return obj.a}}

Answer 0:

Change to this

const obj = {_a: 1}
Object.defineProperty(obj, 'a', {
  get() {
    return obj._a  // The better way to write is return this._a.}})

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *