mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
22 lines
791 B
HTML
22 lines
791 B
HTML
<template name="pkg_coffeescript">
|
|
{{#better_markdown}}
|
|
## `coffeescript`
|
|
|
|
[CoffeeScript](http://coffeescript.org/) is a little language that
|
|
compiles into JavaScript. It provides a simple syntax without lots of
|
|
braces and parentheses. The code compiles one-to-one into the
|
|
equivalent JS, and there is no interpretation at runtime.
|
|
|
|
CoffeeScript is supported on both the client and the server. Files
|
|
ending with `.coffee` or `.litcoffee` are automatically compiled to
|
|
JavaScript.
|
|
|
|
Global variables can be set in CoffeeScript by using `this`, because at the top level `this` refers to the global namespace (`window` on the client and NodeJS's `global` on the server). Thus
|
|
|
|
@myFunction = -> 123
|
|
|
|
at the top level sets the global variable `myFunction`.
|
|
|
|
{{/better_markdown}}
|
|
</template>
|