Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

1.2. Functions

CoffeeScript removes the rather verbose function statement, and replaces it with a thin arrow: ->. Functions can be one-liners or indented on multiple lines. The last expression in the function is implicitly returned. In other words, you don’t need to use the return statement unless you want to return earlier inside the function.

With that in mind, let’s take a look at an example:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial