我注意到了CoffeeScript的編譯器,我一個無法解釋的行爲:)的Node.js - CoffeeScript的編譯器的怪異行爲
例如:
getImage: (req, res) =>
realty_id = req.query.id
if (realty_id?)
結果
ImageController.prototype.getImage = function(req, res) {
var realty_id,
_this = this;
realty_id = req.query.id;
if ((realty_id != null)
但實際上最後一行應該是:if((typeof realty_id!==「undefined」& & realty_id!== null))
當我註釋掉「realty_id = req.query.id」時,效果很好。有沒有人對此有過解釋?
http://stackoverflow.com/questions/9992620/coffeescript-existential-operator-and-this – 2012-11-20 00:09:26
thx爲鏈接 – JimBob