coffeescript Getting started with coffeescript

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

This section provides an overview of what coffeescript is, and why a developer might want to use it.

It should also mention any large subjects within coffeescript, and link out to the related topics. Since the Documentation for coffeescript is new, you may need to create initial versions of those related topics.

Hello Word (Linux and OS X)

CoffeeScript is a scripting language that compiles into JavaScript. Any code written in CoffeeScript can be translated into JavaScript with a one-to-one matching.

CoffeeScript can be easily installed with npm :

$ mkdir coffee && cd coffee
$ npm install -g coffee-script
 

The -g flag will install CoffeeScript globally, so it will always be available on your CLI. Don't use the -g flag if you want a local installation:

$ mkdir coffee && cd coffee
$ npm install coffee-script
 

When the package is installed, create a helloword.coffee file in the working directory and write some CoffeeScript code in it.

console.log 'Hello word!'
 

This code can be executed by calling the CoffeeScript binary. If you installed CoffeeScript globally, simply run:

$ coffee helloword.coffee
 

If you installed CoffeeScript locally, you will find the binary in the installation folder:

$ ./node_modules/coffee-script/bin/coffee helloword.coffee
 

In both cases, the result will be printed in the console: Hello word!



Got any coffeescript Question?