File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
docs/2-browser-apps/03-class Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,19 @@ tanaka.introduceSelf();
313313
314314JavaScript では、開発者が定義しなくても最初から使用可能な<Term >クラス</Term >が数多く用意されています。
315315
316+ 例えば、[ ` Date ` クラス] ( https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Date ) という、日付や時刻を扱うための<Term >クラス</Term >があります。
317+
318+ ``` javascript
319+ const myBirthDay = new Date (" 2014-05-06" ); // Dateクラスをインスタンス化
320+ document .write (myBirthDay .getFullYear ()); // 2014
321+ ```
322+
323+ ` Date ` <Term >クラス</Term >の<Term >コンストラクタ</Term >は、引数として日時を表す文字列をひとつとります。省略された場合には現在の日時を用います。
324+
325+ ` getFullYear ` <Term >メソッド</Term >は、年となる数値を返す<Term >メソッド</Term >です。
326+
327+ { /* prettier-ignore */ }
328+ { /* TODO: 自分はこっちのほうがいいと思いますが...
316329例えば [`Map` クラス](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Map)は、キーと値のペアを保存するオブジェクトを提供します。
317330
318331```js
@@ -329,6 +342,8 @@ map1.set("a", 97);
329342document.write(map1.get("a")); // 97
330343```
331344
345+ \*/ }
346+
332347また、DOM を利用して ` DIV ` 要素を作成または取得すると、[ ` HTMLDivElement ` クラス] ( https://developer.mozilla.org/ja/docs/Web/API/HTMLDivElement ) のインスタンスが得られます。
333348
334349このクラスは [ ` HTMLElement ` クラス] ( https://developer.mozilla.org/ja/docs/Web/API/HTMLElement ) を継承しており、 ` HTMLElement ` クラスは [ ` Element ` クラス] ( https://developer.mozilla.org/ja/docs/Web/API/Element ) を、` Element ` クラスは [ ` Node ` クラス] ( https://developer.mozilla.org/ja/docs/Web/API/Node ) を継承しています。
You can’t perform that action at this time.
0 commit comments