-1

I am trying to decide if want to use Coffeescript or avoid it :)

This is one weird behaviour I had just with this simple function:

equals = (lhs, rhs) -> lhs == rhs ? "IT IS TRUE" : "IT IS FALSE"
alert(equals(1, 2))

This function returns false, not "IT IS FALSE" as expected

Any ideas? thanks

Alessandro De Simone
  • 4,085
  • 6
  • 28
  • 41

1 Answers1

2

I'm not sure CoffeeScript supports the ternary operator like that, try this instead:

equals = (lhs, rhs) -> if lhs == rhs then "IT IS TRUE" else "IT IS FALSE"
GoatInTheMachine
  • 3,583
  • 3
  • 25
  • 35