I often use js2coffee.heroku.com to help me convert JS to CoffeeScript. Here was a line of JS I was converting.
if ( $this.is(':checked') && radioLabel.data('showif') === 'yes' ){
In CoffeeScript, I wrote this:
if $this.is(':checked') && radioLabel.data('showif') == 'yes'
As a Rubyist, I've known about CS's keyword operators (and
, or
, is
, and the like), but I've avoided them because in Ruby, they have different precedence. But CS's and
and or
seem to map directly to JS's &&
and ||
, respectively, without any funny business. Thus, js2coffee rendered that line
if $this.is(":checked") and radioLabel.data("showif") is "yes"
So here's my question. Even if there's no functional difference between the two, there's definitely a stylistic difference. I'd love to write the most idiomatic CS possible. So is there a more widely use standard in the CS community between these two styles?