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.
尝试实例化MyClass()s 时出现以下错误。
MyClass()
s = new MyClass(); > TypeError: 'undefined' is not a function (evaluating '_class.apply(this, arguments)')
是类
class MyClass constructor: (@value = 'defaultValue') ….
知道是什么导致了这个错误吗?
构造函数需要是一个函数,因此您需要指定->:
->
class MyClass constructor: (@value = 'defaultValue') ->
演示