class 字段和 Javascript 中的属性有什么区别

What is the difference between class fields and properties in Javascript

我正在为 JavaScript 阅读 class fields proposal。我不明白为什么作者称它为 'fields' 而不是属性。

class article speak about instance properties declared inside constructor and in next section about field declarations 中的 MDN 文档使用新语法声明。

两者除了语法之外还有什么区别?

What is the difference between the two besides the syntax?

没有。 public 字段是一个实例 属性,只是一个使用字段定义而不是通过赋值创建的实例。除了创建方式不同,它们完全相同。

使用术语 "field" 是为了它可以涵盖 public 和私有(因为私有字段是 不是 属性)。