LoginSignup
5
5

More than 5 years have passed since last update.

CoffeeScriptでオブジェクトのプロパティに同名の変数を代入する時の書き方

Last updated at Posted at 2013-10-05
obj.coffee
obj = {hoge}

こう書くと

obj.js
var obj;

obj = {
  hoge: hoge
};

こうなる

obj.coffee
obj = {hoge, fuga, foo}

複数指定も

obj.js
var obj;

obj = {
  hoge: hoge,
  fuga: fuga,
  foo: foo
};

この通り

最近知ったのでメモ。便利ですね。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5