I have this piece of javascript:
if(this.isShown || event.isDefaultPrevented()){
return;
}
And I tried to convert it into Coffeescript but I can’t seem to get the null return to work:
if @isShown or event.isDefaultPrevented()
return;
How can I get it working properly?
It appears that the CoffeeScript compiler won’t implicitly return null unless it needs to to prevent later code from executing. If something happend after that code, it would add the null return, e.g.:
Whereas in your case above, the function would just exit anyway after the conditional, rendering a null return unnecessary.