Check if a variable is defined in CoffeeScript
In JavaScript it’s pretty common to check if a variable has been created. You would usually perform the check with the following code:
This is the equivalent syntax in CoffeeScript.
This will generate the following JavaScript:
Much neater. Happy coding.