記事へのコメント1件
- 注目コメント
- 新着コメント
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Delete instance of a class?
I have a class that was created like this: function T() { this.run = function() { if (typeof this... I have a class that was created like this: function T() { this.run = function() { if (typeof this.i === 'undefined') this.i = 0; if (this.i > 10) { // Destroy this instance } else { var t = this; this.i++; setTimeout( function() { t.run(); }, 1000); } } } Then I initialize it like var x = new T(); I'm not sure how to destroy this instance from within itself once if reaches 10 iterations. Also, I'm



2016/07/01 リンク