Joined March 2014
·

Michal Srb

NYC, London, Prague
·
·

Posted to Beauty of CoffeeScript over 1 year ago

Hi Rashmi, I am happy to see you use CoffeeScript for your projects. Couple comments on your blogpost:

Using standalone @ instead of this is generally discouraged in the community.

x if a is on where a is a boolean is an antipattern (as opposed to x if a), unless you are not sure that a is indeed a boolean - it just struck me in the example.

The ?= operator doesn't do what you probably assume it does - it checks the left hand side operand's value for existence and if the value is null or undefined assigns to it the right hand side. The code alert('rays') if(a?=0) would assign to a 0 if a was undefined and then not alert because if evaluates 0 as false. You also don't need the parentheses around the if condition.

Hope this clears some things up! Best of luck in your CoffeeScript ventures!

Achievements
69 Karma
0 Total ProTip Views