如何区分 class get set 和 constructor 属性

How to differentiate between class get set and constructor attributes

什么是隐藏字段(argument1),我进入 chrome 控制台?

class ClassName {
  constructor(argument1) {
    this._argument1 = argument1;
  }

  get argument1() {
    return this._argument1 + " by get method.";
  }

  set argument1(value) {
    if (value.length < 4) {
      console.log("Please provide name with more length.");
      return;
    }
    this._argument1 = value;
  }
}

let object1 = new ClassName("abcde");
console.info(object1);

chrome-console-output

这是你的 getter - get argument1()
在展开字段之前查看工具提示: