[[クラス (JavaScript)|クラス]]に追加された[[プロパティ (JavaScript)|プロパティ]]のこと。 > [!note] > フィールドはドキュメントによって定義や想定が異なる場合があり、[[メソッド (JavaScript)|メソッド]]は[[フィールド (JavaScript)|フィールド]]に含めないようなケースもある。ただ、[[MDN]]の[[パブリッククラスフィールド (JavaScript)]]を見る限り、[[メソッド (JavaScript)|メソッド]]も含めてフィールドと読んでそうに見える。正確な定義が分かったら追加したい。 ```ts class Rectangle { static staticValue = 10; constructor(height, width) { this.height = height; this.width = width; } print() { console.log(this); } } const r1 = new Rectangle(10, 10); const r2 = new Rectangle(20, 20); console.log(r1.staticValue); // undefined (クラスオブジェクトからstaticなフィールドにはアクセスできない) console.log(r1.height); // 10 console.log(r1.print); // [Function: print] console.log(r2.staticValue); // undefined (クラスオブジェクトからstaticなフィールドにはアクセスできない) console.log(r2.height); // 20 console.log(r2.print); // [Function: print] console.log(Rectangle.staticValue); // 10 console.log(Rectangle.height); // undefined (クラスオブジェクトからフィールドにはアクセスできない) console.log(Rectangle.print); // undefined (クラスオブジェクトからメソッドにはアクセスできない) console.log(Rectangle.prototype.print); // [Function: print] (prototype経由なら可能) ```