Skip to content

Instantly share code, notes, and snippets.

@satyr
Created June 28, 2011 06:36
Show Gist options
  • Save satyr/1050612 to your computer and use it in GitHub Desktop.
Save satyr/1050612 to your computer and use it in GitHub Desktop.
  • 行末のセミコロンが不要

ASI じゃないので「不要」は語弊。

  • インデントで関数定義のブロックを表現する

「関数定義の」が余計。

" " でくくった文字列の中では #{変数名} で変数の値を埋め込むことができます

変数名の直後に ? を付けると

変数に限らない。

== は意図しない型変換が行われる可能性があるため is を使って厳密に比較します

  • is== の別名。
  • Coffee の == は JS の ===

for文には値をまとめて受け取る構文があります

「まとめて受け取るための構文」があるわけではない。 意味上は for/while の値は常に配列。値が不要な場合に _results が省略される。

{_} = require('./underscore')

間違ってはいないが、1.1.3 以降は単に _ = require './underscore' と書けるので良い例ではない。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment