I'm new to coffeescripts. Can the getSum
method be simplified more? Thanks
MyObject =
checkCondition: (num) ->
return true if num is 5
getSum: (num) ->
total = 0
total += i for i in [1..num] when @checkCondition i
total
I tried removing the last total but coffeescripts compiler goes nut :-/
Any help greatly appreciate.