Q:

How to write this simple javascript code in CoffeeScript?

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

A:

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];

