Recommended
PPTX
PPTX
PDF
PDF
ちょっと詳しくJavaScript 第4回【スコープとクロージャ】
PPTX
PDF
PDF
PPTX
PDF
Plano de Marketing Ciao CSN Setembro 2013
ODP
PPTX
PDF
Educação ambiental ecoturismo e u cs
SXW
PPTX
PPT
DOC
PDF
ODT
PPTX
PPTX
Enviar documentos por plataforma
PDF
Curso mantenimiento subestaciones
PPTX
Memorable 2013 - Tereschenko Maxim
PPTX
Aquamarina Golf Holiday Rental Cap Cana
PDF
Introduccion a la regulacion del sector electrico
PPT
PPTX
PDF
図とコード例で多分わかる React と flux (工事中)
PDF
Gitを理解するためにおさえておきたい3つの図(工事中)
PDF
PDF
JS 6th edition reading circle part 2
More Related Content
PPTX
PPTX
PDF
PDF
ちょっと詳しくJavaScript 第4回【スコープとクロージャ】
PPTX
PDF
PDF
PPTX
Viewers also liked
PDF
Plano de Marketing Ciao CSN Setembro 2013
ODP
PPTX
PDF
Educação ambiental ecoturismo e u cs
SXW
PPTX
PPT
DOC
PDF
ODT
PPTX
PPTX
Enviar documentos por plataforma
PDF
Curso mantenimiento subestaciones
PPTX
Memorable 2013 - Tereschenko Maxim
PPTX
Aquamarina Golf Holiday Rental Cap Cana
PDF
Introduccion a la regulacion del sector electrico
PPT
PPTX
More from Teloo
PDF
図とコード例で多分わかる React と flux (工事中)
PDF
Gitを理解するためにおさえておきたい3つの図(工事中)
PDF
PDF
JS 6th edition reading circle part 2
PDF
PDF
JS 6th edition reading circle part 3 1. 2. 3. 4. 5. 6. グローバル変数とローカル変数
var g1 = ‘global’; // グローバル変数
function checkscope() {
var local = ‘local’; // ローカル変数
g2 = ‘global’; // グローバル変数
};
checkscope();
7. 8. 9. 10. 問題
var scope = ‘global’;
●
(1) で出力されるのは?
a. global
b. local
c. 上記以外
●
(2) で出力されるのは?
a. global
b. local
c. 上記以外
function f() {
console.log(scope); // (1)
var scope = ‘local’;
console.log(scope); // (2)
}
f();
11. 12. 13. 例
100 == 10 * 10; // true
‘abc’ == ‘def’; // false
true != false // true
true == 1 // true
0 == ‘0’ // true
‘’ != false // false
14. 15. 例1
100 === 10 * 10; // true
‘abc’ === ‘def’; // false
true !== false // true
true === 1 // false
0 === ‘0’ // false
‘’ !== false // true
16. 例2
var a = {
a: ‘hoge’,
b: ‘piyo’
};
var b = {
a: ‘hoge’,
b: ‘piyo
};
a === b // false
a === a // true
オブジェクト型は参照で同値かどうかを判
定される
17. 18. 19. 例
var obj = {
n: 3,
s: ‘test’,
b: true
};
for (var p in obj) {
console.log(p); // n, s, b
console.log(obj[p]); // 3, test, true
}
20.