I have written this function in coffeescript:
doCalculate = (old, new) ->
difference = roundNumber (old - new, 5)
but when compiled generates the error:
throw Error("ExecJS::RuntimeError: SyntaxError: unexpected ,
If I remove the , 5 part I get no error any more.
I can't figure what's wrong with a comma.
The function roundNumber is defined as follows, in the same file:
roundNumber = (rnum, rlength = 6) ->
pow = Math.pow( 10, rlength )
newnumber = Math.round ( rnum * pow ) / pow
parseFloat(newnumber)
roundNumber(entry - exit, 5)