Check if a variable is defined in CoffeeScript
Jun 4, 2013
    In JavaScript it’s pretty common to check if a variable has been created. You would usually perform the check with the following code:
if (type someVariable !== "undefined") {
  // code goes here
}This is the equivalent syntax in CoffeeScript.
if someVariable?
  # code goes hereThis will generate the following JavaScript:
if (typeof someVariable !== "undefined" && someVariable !== null) {
  // code goes here
}Much neater. Happy coding.