• 検索結果がありません。

Javaエンジニアのための「HTML5プロフェッショナル認定試験 レベル2解説無料セミナー

N/A
N/A
Protected

Academic year: 2018

シェア "Javaエンジニアのための「HTML5プロフェッショナル認定試験 レベル2解説無料セミナー"

Copied!
100
0
0

読み込み中.... (全文を見る)

全文

(1)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

Java

HTML5

認定試験

2

解説無料セ

LPI-Japan

主催

株式会社 生形可奈子

(2)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

2

ン ー

成長 牽引

いう

事業コンセ

HTML5

JavaScript

Web

技術

ー支援事業 行

開発環境

Monaca

(3)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

3

生形 可奈子 うぶ

講師・

Monaca

Java/C#

中心

業務・制御系 ン

出身

著書:

JavaScript

Monaca

学ぶ

入門編~

(4)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

HTML5

認定試験

概要

試験範囲

頻出・難解

ン 解説

JavaScript

ー 型

文字列/配列

関数

コー

prototype

/継承

(5)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

5

(6)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

2014

10

月正式勧告

ン ・

対応・

対応

広義

CSS3

JavaScript

3D

WebSocket

ー 等 含

(7)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

特定非営利活動法人

LPI-Japan

実施

HTML5

び周辺技術 知識

測 認定制度

試験 難易度 示

2

種類

段階的 受験

Level1

対応

静的

Web

コン ン

HTML5

使

ン 作

Level2

間連携や最新

術 対応

Web

ンや動的

Web

コン ン

開発・設計

(8)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

出題範囲

重要度

JavaScript

JavaScript

文法

★★★★★★★★★★

10

Web

JavaScript API

ベン

★★★★★★★★

8

キュメン オ

DOM

★★★★★★

6

★★★★★★★★

8

Canvas(2D)

★★★★★★

6

(9)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

試験方式 コン

CBT

試験配信会

ソン

VUE

受験

問題数

40

45

試験時間

90

合格

7

回答方式

選択式 複数回答あ

記述式も1問程度

コー

ン 問題 多い

受験料

¥15,000

税抜

(10)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

(11)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

当初

Mocha

LiveScript

いう名前

開発元

Netscape

Sun

社 現

Oracle

提携

JavaScript

改名さ

初期

Web

簡単 動

ー 入力 補助

目的 簡易的言語

(12)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

最新動向

Gmail

登場

上 実現

増え

JavaScript

脚光 浴び

様々

JavaScript

ー ワー

台頭

大規模

Web

ン 構築 可能

進化系

構築や

制作

用い

増え

(13)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

標準仕様

JavaScript

独自 実装さ

独自仕様

い 場合 あ

ActionScript

JScript

JavaScript

以外 言語 存在

上記言語 標準化

仕様

EcmaScript

言語仕様

定義

HTML5 API

DOM

(14)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

ン履歴

現在主要

完全

ー さ

2009

年 策定さ

EcmaScript5

試験範囲

EcmaScript5

基準

2015

年 承認さ

新 ー

仕様 大幅 改定さ

以降 毎年改定 行う体制 変更 名称

ES6

ES2015

変更

(15)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

影響 受

い 言語

コー

記述方法

Java

似 い

言語仕様

最 影響 受

Scheme

Self

Java

JavaScript

主 違い

15

言語

指向分類

Java

静的型付

(16)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

ー 型

(17)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

動的型付 言語

型 実行時 決定さ

変数宣言時 型 限定

変数宣言 例

実行時

ー 型 判定さ

17

var

変数名

;

var x;

x = 10;

(18)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

ー 型一覧

18

型 分類

代表的 型

を持

数値、文字列、論理値

null

値 存在

undefined

値 定義さ

い い

(19)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

19

null

… 値 存在

意図的 示 値

getElementById()

取得 よう

要素

HTML

文書内 存在

い場合

、メソッ

戻 値

返却さ

ウをよらりiをらよ … 値

定義さ

い い

示 値

初期化さ

い い変数、定義さ

い い ロ

return

(20)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

20

JavaScript

等価演算子

二種類あ

値 等 い

比較

緩や

等価演算子

等 い

比較

厳密 等価演算子

演算子

説明

結果

==

緩や

等価演算子

5 == '5'

true

===

厳密 等価演算子

5 === '5'

false

!=

緩や

不等価演算子

5 != '5'

false

(21)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

21

算術演算子

演算子

説明

結果

+

数値 加算

1 + 1

2

+

文字列 連結

'Hello' + 'World'

'HelloWorld'

-

数値 減算

2

1

1

*

数値 乗算

2 * 2

4

/

数値 除算

10 / 2

5

(22)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

22

+

演算子 挙動

演算対象

ー 型

変わ

100 + 'px'

// '100px'

文字列型

(23)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

条件式

値 評価

論理値以外 値

if

条件式

指定

以下

判定さ

23

true

false

0

以外 数値

1

文字以上 文字列

中身 空

0

空文字

""

undefined

(24)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

24

引数 省略

用い

function check(x) {

//

引数

x

が空 っ

ラーにす

if(!x) {

console.log("

ラー:値が入っていません

");

return;

}

(25)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

25

0

や空文字

false

判定さ

注意

function check(x) {

//

引数

x

が空 っ

ラーにす

if(!x) {

console.log("

ラー:値が入っていません

");

return;

}

//

以降、省略

}

check();

//

想定通

ラー

(26)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

基本

(27)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

27

複数

集合体 あ

属性値 保持

操作 行う

(28)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

28

Object

Object

String

文字列

Array

配列

Function

関数

toString()

valueOf()

hasOwnProperty()

(29)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

29

生成方法

Object

生成 、オ

{}

代用

可能

Array

生成 、配列

[]

代用

可能

生成 例

var

変数名

= new

オブジェ トの型名

(

引数

);

(30)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

30

生成時 流

生成時

コン

いう関数 実行さ

コン

新 く

生成

戻 値

返却

呼ぶ

var list = new Array(1,2,3);

(31)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

31

typeof

演算子

型 調

演算子

String

Array

object

判定さ

※ 関数

function

判定さ

var list = new Array(1,2,3);

(32)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

32

instanceof

演算子

コン

生成さ

判定

種類 調

var list = new Array(1,2,3);

(33)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

ー ー定義

(34)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

34

ー ー定義

作成

new

使用

使用

var

クト名

= new Object();

(35)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

35

使用

使用

変数名

.

ロパテ 名

(36)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

36

生成

var obj = {

name: "

生形

"

};

//

ロパテ へ

クセ

console.log(obj.name);

//

以下

うに記述す ことも可能

var propertyName = "name"

(37)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

文字列

(38)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

38

文字列

以下 二種類

ー ・

文字列

型 二種類 あ

文字列

'

こんに

'

"

こんに

"

var str1 = "

こんに

";

//

ミテ ブ型

(39)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

39

型 文字列

"hoge"

String

length

replace()

substr()

"hoge"

型 複数

(40)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

型 対応

40

数値

Number

文字列

String

(41)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

以下 実行結果 ?

問題:

型 対

指定

41

console.log("hoge".length);

A)

4

B)

null

C)

undefined

(42)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

呼び出

場合

対応

暗黙的 変換 行わ

42

"hoge".length

"hoge"

length

replace()

substr()

"hoge"

(43)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

以下 実行結果 ?

true / false

問題:

比較

43

var a = "hoge";

var b = new String("hoge");

console.log(a

==

b);

以下 実行結果 ?

true / false

var a = "hoge";

(44)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

以下 実行結果 ?

true / false

問題:値 比較 参照 比較

44

var a =

"hoge"

;

var b =

"hoge"

;

console.log(a == b);

以下 実行結果 ?

true / false

(45)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

型 値

比較

45

型 参照

比較

a

b

(46)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

46

a

b

"hoge"

"hoge"

var a = new String("hoge");

var b = a;

console.log(a == b);

こ 場合 同 オ

(47)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

配列

(48)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

48

配列 作成

new

使用

配列

使用

var

配列名

= new Array(1, 2, 3);

(49)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

49

var list = [];

//

空の配列を作成

list[0] = "AAA";

list[1] = "BBB";

list[2] = "CCC";

(50)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

以下 実行結果 ?

50

var array = [10, 20, 30];

array[

9

] = 99;

console.log(array.length);

A)

3

B)

4

C)

10

(51)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

51

0

1

2

10

20

30

9

99

連番

割 振

(52)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

関数

(53)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

関数

一種

関数

Function

いう名前

一種

変数 値

代入

可能

Fuction

代入

実現

53

var obj = {

method1: function (message) {

alert(message);

(54)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

関数宣言

54

func("hello");

function func(message) {

alert(message);

}

関数

func

いう名前

(55)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

関数式

55

var func =

function(message) {

alert(message);

};

func("hello");

func

いう変数 関数 代入

(56)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

即時関数

56

(

function(message) {

alert(message);

}

)

(

"hello"

)

;

(

関数 定義

)

(

引数

)

;

定義 呼び出

同時 行う

(57)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

引数

可変長引数

ー記法

(58)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

引数

58

function f(x,

y=20

){

console.log(x); // 10

console.log(y); // 20

}

f(10);

(59)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

可変長引数

59

function f(

...args

) {

for(var i=0; i<args.length; i++) {

console.log(args[i]);

}

}

f(10, 20);

f(10, 20, 30, 40);

(60)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

従来 記法

60

var f = function(x) { return x * 2; };

function

キーワー

省略

引数

場合

()

省略

処理

return

場合

{}

return

キーワー

省略

ー記法

(61)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

変数

コー

(62)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

変数

コー

有効範囲 内

参照

コー

関数単位 作

62

var a

= 10;

// a

ローバル変数 ので こからでも参照可

function func1()

{

var b

= 20;

function func2(

c

)

{

c

= 30;

}

}

(63)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

コー 外 変数 参照

場合

ReferenceError

発生

63

var a

= 10;

function func1()

{

var b

= 20;

function func2(

c

)

{

c

= 30;

}

}

func1();

console.log(

a

); // 10

(64)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

var

い い場合

変数

コー

64

var a

= 10;

function func1()

{

b

= 20;

function func2(

c

)

{

c

= 30;

}

}

func1();

console.log(

a

); // 10

console.log(

b

); // 20

(65)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

use strict

厳格 ー

宣言

var

付 忘

推奨さ

い記述 対

警告 表示さ

65

function func() {

"use strict";

b = 20;

//

(66)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

66

内 値や

暗黙的 一番外側 存

<script>

var a = 10;

var obj = {

prop: "hoge"

};

</script>

a

obj

(67)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

67

環境

Window

Window

alert()

document

open()

setInterval()

location

(68)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

68

変数=

<script>

var a = 10;

console.log(a);

// 10

console.log(window.a);

// 10

(69)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

69

複数

JS

読 込

い 場合

変数 競

う場合 あ

利用 必要最小限

lib1.js

<script src="lib1.js">

<script src="lib2.js">

index.html

lib2.js

var x = 10;

var x = 20;

(70)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

ー ン

コー

重複

許可さ

70

var

x

= 10;

//

ローバル コー

function func1() {

var

x

= 20;

//

ロー ル コー

console.log(

x

);

// 20

}

上記 場合

コー

コー

同名 変数 宣言

(71)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

以下 実行結果 ?

71

if(1 == 1) {

var a

= "hoge";

}

console.log(

a

);

A)

B)

undefined

C)

null

(72)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

JavaScript

コー

コー

発生

関数内

EcmaScript2015

コー

有効

let

キーワー

追加さ

72

if(true) {

let a

= "hoge";

}

(73)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

以下 実行結果 ?

73

var a

= "global";

function func() {

console.log(

a

);

var a

= "func";

}

func();

A)

B)

undefined

C)

"global"

(74)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

変数 巻 上

74

var a = "global";

function func() {

var a;

console.log(a);

a = "func";

}

func();

関数 途中 宣言さ

変数

関数 先頭 巻 上

宣言さ

初期値

代入さ

い 値 巻 上

コー

以下

う 解釈さ

(75)

© Asial Corporation 2014. All rights reserved.

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

prototype

(76)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

76

JavaScript

指向言語

基礎

新 い

生成

仕組

新 く作

(

)

(

)

(

)

(77)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

77

組 込

[0]

[1]

[2]

Array

10

20

30

[0]

[1]

[2]

'A'

'B'

'C'

ン タン

ロ タ

(78)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

78

=関数

基礎

ー 言語

役割

関数

生成

new

演算子 使う

var Dog = function() { };

(79)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

79

コン

=関数 処理

関数内 処理

生成

new

コン

実行さ

var Dog = function(_name) {

this.name = _name;

this.show = function() {

alert(this.name);

};

};

var dog1 = new Dog("

ポチ

");

//

コン

タを実行

(80)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

80

ン =

Object

Function

Object

var Dog = function(_name) {

//

省略

};

var dog1 = new Dog("

ポチ

");

console.log(

typeof Dog

);

//

function

(81)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

81

コン

暗黙的処理

Object

コン

暗黙的 新 い

Object

生成

var Dog = function(_name) {

var this = {};

this.name = _name;

this.show = function() {

alert(this.name);

};

return this;

};

var Dog = function(_name) {

this.name = _name;

this.show = function() {

alert(this.name);

};

};

(82)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

82

各 ン

prototype

参照

prototype

各 ン

共通 機能 格納

(

)

(

)

ロ タ

(83)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

83

ン 化

定義さ

各 ン

コ ーさ

var Dog = function(_name) {

this.name = _name;

this.show = function() {

alert(this.name);

};

};

var dog1 = new Dog("

ポチ

");

var dog2 = new Dog("

");

name

show()

name:

ポチ

show()

name:

show()

Dog

dog2

dog1

(84)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

84

各 ン

内部的 持

__proto__

prototype

参照

var Dog = function(_name) {

this.name = _name;

};

Dog.prototype.show =

function() {

alert(this.name);

};

var dog1 = new Dog("

ポチ

");

var dog2 = new Dog("

");

name

name:

ポチ

__proto__

name:

__proto__

Dog

dog2

dog1

参照

show()

(85)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

85

以下

Array

prototype

定義さ

join

呼び出

い 例

var list = ['a', 'b', 'c'];

var str = list.join('+');

console.log(str);

//a+b+c

[0]: a

[1]: b

[2]: c

__proto__

Array

list

参照

join

メソッ

pop

メソッ

sort

メソッ

(86)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

継承

(87)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

87

・機能

C

継承

拡張

作 仕組

・機能

A

・機能

B

・機能

A

・機能

B

(88)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

88

最 単純 継承関係

prototype

代入

//

var Parent = function() {

this.x = 10;

};

Parent.prototype.show =

function() { alert(this.x); };

//

var Child = function() {

this.y = 20;

};

//

継承

Child.prototype = new Parent();

(89)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

89

探索

順序

自身

ン タン 内 該当 ロ

う を調べ

ロ タ

prototype

内を調べ

(90)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

90

(91)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

91

prototype

親 持

同名

定義

//

var Parent = function() {

this.x = 10;

};

Parent.prototype.show =

function() { alert(this.x); };

//

var Child = function() {

this.y = 20;

};

//

継承

Child.prototype = new Parent();

//

メソッ のオーバー

Child.prototype.show =

function() {

alert(this.x + this.y);

};

(92)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

92

x

y

__proto__

Parent

Child

ン タン

参照

y

Child

prototype

new

参照

show

メソッ

new

prototype

x

show

__proto__

Parent

ン タン

show

メソッ

見 い

オー ー

show

メソッ

(93)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

93

for/in

ー 定義

走査

ーン 遡

走査さ

var child = new Child();

for(var key

in

child){

(94)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

94

hasOwnProperty

自身 持

調

論理値 返

var child = new Child();

for(var key in child){

if(child.hasOwnProperty(key)) {

console.log(key + ':' + child[key]);

}

(95)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

95

class

構文

ー 言語

う 扱う

class Parent {

show(text) {

console.log(text);

}

};

class Child

extends

Parent {

show() {

super

.show("child");

}

};

キーワー

継承関係 実現

prototype

定義さ

(96)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

受験対策

(97)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

HTML5 Web

標準

API

コ ・

JavaScript

HTML5 API

97

対策本

HTML5

認定

(98)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

(99)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

99

(100)

The HTML5 Logo is licensed under Creative Commons Attribution 3.0. Unported by the W3C; http://creativecommons.org/licenses/by/3.0/

参照

関連したドキュメント

Figures 10 and 11 show the mean and the coefficient of variation of the waiting time as a function of g2 for the NPNV model, where we assume that Pl P2 P3- P4 0.1, that the batch

On the other hand, when M is complete and π with totally geodesic fibres, we can also obtain from the fact that (M,N,π) is a fibre bundle with the Lie group of isometries of the fibre

Kilbas; Conditions of the existence of a classical solution of a Cauchy type problem for the diffusion equation with the Riemann-Liouville partial derivative, Differential Equations,

This paper develops a recursion formula for the conditional moments of the area under the absolute value of Brownian bridge given the local time at 0.. The method of power series

The study of the eigenvalue problem when the nonlinear term is placed in the equation, that is when one considers a quasilinear problem of the form −∆ p u = λ|u| p−2 u with

The variational constant formula plays an important role in the study of the stability, existence of bounded solutions and the asymptotic behavior of non linear ordinary

In fact, we have shown that, for the more natural and general condition of initial-data, any 2 × 2 totally degenerated system of conservation laws, which the characteristics speeds

(b) 肯定的な製品試験結果で認証が見込まれる場合、TRNA は試験試 料を標準試料として顧客のために TRNA