0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

js基本のキ

0
Last updated at Posted at 2020-12-21

・ルール
大文字、小文字は区別される。
forEachはいけるが、foreachはエラーになる。

・定数、変数
const 定数
let 変数
あたいがコロコロ変わるとややこしいので、基本はconstを使いつつ、必要な時にletを使う。
名前のつけかた。
英数字、$、_のみ使える。
数値からはじめることはできない。

・関数をオブジェクトのプロパティの値にした場合、その関数をメソッドと呼ぶ

・静的メソッド
インスタンスを介さず呼び出せるメソッドを静的メソッドと呼ぶ。メソッド名の前にstaticをつけてあげる。
thisはクラスから作られたインスタンスを指すため。インスタンスを作らず呼び出すこのメソッドは、thisを使えない。

・継承
class 子クラス extends 親クラス {
}
extends...拡張する
子クラスの constructor() で this キーワードを使うには constructor() の最初で super() を記述する必要がある。親クラスでthis.textがあれば、super(text)

superに繋げて書けば親クラスのメソッドを呼べる

show() {
console.log(${this.text} - ${this.likeCount}likes);
}

show() {
super.show(); <= console.log(${this.text} - ${this.likeCount}likes);
console.log(... sponsored by ${this.sponsor});
}

・今時はprettirとESlintを組み合わせて使うらしい。

・ビルド
ソースコードを実行可能な状態にすること

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?