LoginSignup
1
1

More than 5 years have passed since last update.

わーい、すごーい

Posted at

元ネタ
わーい、すごーい
に触発されて書いた
わーい、すごーい
のES6版


class フレンズ {
  constructor() {
    this.message = '';
  }

  わーい() {
    this.message += 'わーい\n';
    return this;
  }

  すごーい() {
    this.message += 'すごーい\n';
    return this;
  }

  たのしー() {
    this.message += 'たのしー\n';
    return this;
  }

  フレンズ(skill) {
    this.message += `君は${skill}がとくいな、フレンズなんだね!!\n`;
    return this;
  }

  toString() {
    var message = this.message;
    this.message = '';
    return message;
  }
}

alert(new フレンズ()
  .わーい()
  .すごーい()
  .たのしー()
  .フレンズ('クソリプ'));

動作確認
http://runstant.com/simiraaaa/projects/wai_sugoi_ES6

1
1
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
1
1