【发布时间】:2014-01-09 00:14:02
【问题描述】:
各位, 试图弄清楚这两个语句之间的区别,以及为什么一个有效,另一个抛出错误:
作品:
jsonFileContents = fs.readFileSync('sample.json', 'utf8')
res.send(jsonFileContents)
没有:
jsonFileContents = fs.readFileSync('sample.json', 'utf8')
returnResult(jsonFileContents)
returnResult = (data) ->
res.send data
抛出错误:
`TypeError: undefined is not a function`
【问题讨论】:
-
伙计们,我完全知道这个函数是同步的 :) 只是在这里测试一些东西,看到这个,我想问一下 :) 谢谢!
标签: coffeescript