我想要这段代码在 javascript 中:
beforeNode = children[ children.length -1 ]
使用咖啡脚本中的这段代码:
beforeNode = children[ children.length -1 ]
咖啡脚本生成:
beforeNode = children[children.length(-1)];
如何在 coffescript 中编写源代码以生成预期的 javascript 代码?
谢谢
我想要这段代码在 javascript 中:
beforeNode = children[ children.length -1 ]
使用咖啡脚本中的这段代码:
beforeNode = children[ children.length -1 ]
咖啡脚本生成:
beforeNode = children[children.length(-1)];
如何在 coffescript 中编写源代码以生成预期的 javascript 代码?
谢谢
不要使用空间!
// coffeescript
beforeNode = children[children.length-1]
或者在每边使用一个空间-
// coffeescript
beforeNode = children[children.length - 1]
结果是
// js
var beforeNode;
beforeNode = children[children.length - 1];
或者使用两个空格!
# coffeescript
beforeNode = children[children.length - 1]
结果是
// javascript
var beforeNode;
beforeNode = children[children.length - 1];