Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我阅读 JavaScript The Definitive Guide,第 9.3 节时,我遇到了这个问题:
类方法 这些是与类关联而不是与实例关联的方法。
如何在 JavaScript 中实现类方法?
您可以创建一个函数作为另一个函数的属性:
function MyClass() { } MyClass.someFunction = function() { };