【发布时间】:2014-01-14 13:14:15
【问题描述】:
CoffeScript 代码:
department = ->
console.log 1
这编译成js代码:
// Generated by CoffeeScript 1.6.3
(function() {
var department;
department = function() {
return console.log(1);
};
}).call(this);
我有一个按钮:
<button onclick = "department()" >add department</button>
但是当我点击它时,它会抛出一个错误:
未捕获的引用错误:部门未定义
那我该怎么办?
【问题讨论】: