Drkcore

19 04 2012 coffeescript Tweet

CoffeeScriptのnew @(objects)

spineのソースコードでわからないとこがあって、なんで@をnewしてんの?っていう。

class Test
  constructor: (@name)->

  @test:(name) ->
    new @ name

test1 = new Test 'xxx'
test2 = Test.test('yyy')

console.log test1
console.log test2

new @ nameはTestクラスのコンストラクタ関数を指しているという理解をした。

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021