Reputation: 4177
I want this code in javascript:
beforeNode = children[ children.length -1 ]
With this fragment of code in coffeecript:
beforeNode = children[ children.length -1 ]
coffescript generate:
beforeNode = children[children.length(-1)];
How can I write source in coffescript to generate expected javascript code?
Thanks
Upvotes: 0
Views: 93
Reputation: 77778
Don't use a space!
// coffeescript
beforeNode = children[children.length-1]
Or use a space on each side of the -
// coffeescript
beforeNode = children[children.length - 1]
Results in
// js
var beforeNode;
beforeNode = children[children.length - 1];
Upvotes: 2
Reputation: 1642
Or use two spaces!
# coffeescript
beforeNode = children[children.length - 1]
Results in
// javascript
var beforeNode;
beforeNode = children[children.length - 1];
Upvotes: 0