-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2-03(Boolean)함수.html
More file actions
35 lines (31 loc) · 1.17 KB
/
2-03(Boolean)함수.html
File metadata and controls
35 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<html>
<head>
<title>Boolean 함수</title>
</head>
<body>
<script>
// var x1 = true;
// var y1 = new Boolean(true); // 객체
// console.log(x1);
// console.log(y1); // object type의 true
// console.log(typeof x1); // type : boolean
// console.log(typeof y1); // type : object
// console.log(x1 == y1); // true, 실제 가지고 있는 값을 비교함(type 상관 X)
// console.log(x1 === y1); // false, type까지 비교
// var x2 = "abc"; // string
// var y2 = new String("abc"); // string 객체
// console.log(x2); // abc
// console.log(y2); // abc(string type)
// console.log(typeof x2); // string
// console.log(typeof y2); // object
// console.log(x2 == y2); // true, type 상관 X
// console.log(x2 === y2); // false, type 상관 O
// var x = 0;
// console.log(x); // 0
// console.log(Boolean(x)); // false, 0 : false, 0이 아니면 무조건 true
var x; // 1이 아니면 false 처리
console.log(x); // 초기화 X -> undefined
console.log(Boolean(x)); // false
</script>
</body>
</html>