-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataType.js
146 lines (99 loc) ยท 2.18 KB
/
dataType.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
var str = "Hello";
var num = 1;
var bool = true;
var foo = "string";
console.log(typeof foo);
foo = 1;
console.log(typeof foo);
var integer = 10;
var double = 10.12;
var negative = -20;
var binary = 0b01000001;
var octal = 0o101;
var hex = 0x41;
console.log(integer)
console.log(double)
console.log(negative)
console.log(binary)
console.log(octal)
console.log(hex)
console.log(binary === octal);
console.log(octal === hex);
console.log(1 === 1.0);
var result = 4/2;
console.log(result);
result = 3/2;
console.log(result);
var pInf = 10/0;
console.log(pInf);
var nInf = 10/-0;
console.log(nInf);
var nan = 1 * "string";
console.log(nan);
var str = "string";
str = 'string';
str = `string`;
str = "ํฐ ๋ฐ์ดํ๋ก ๊ฐ์ผ ๋ฌธ์์ด ๋ด์ '์์ ๋ฐ์ดํ'๋ ๋ฌธ์์ด์ด๋ค."
str = '์์ ๋ฐ์ดํ๋ก ๊ฐ์ผ ๋ฌธ์์ด ๋ด์ "ํฐ ๋ฐ์ดํ"๋ ๋ฌธ์์ด์ด๋ค.'
var str = "string";
//๋ฌธ์์ด์ ์ ์ฌ๋ฐฐ์ด์ด๋ค.
for (var i = 0; i < str.length; i++){
console.log(str[i])
}
//ํ ๋ฒ ์์ฑ๋ ๋ฌธ์์ด์ ์ผ๋ถ ๋ฌธ์๋ฅผ ๋ณ๊ฒฝํ๋ ค ํด๋ Read only๋ก์จ ๋ณ๊ฒฝํ ์ ์๋ค.
str[0] = "R";
console.log(str);
//์ฌํ ๋น์ ๊ฐ๋ฅํ๋ค.
var str = "string";
console.log(str);
str = "String";
console.log(str);
str += " test";
console.log(str);
str = str.substring(0, 3);
console.log(str);
str = str.toUpperCase();
console.log(str);
var foo = true;
var bar = false;
console.log(typeof foo);
console.log(typeof bar);
var foos;
console.log(typeof foos);
// var element = document.querySelector('.myElem');
// console.log(element);
var score;
score = 80;
score = 90;
score;
var average = (50 + 100) / 2;
var circleArea = 3.1415 * 2 * 2;
var cylinderVolume = circleArea * 5;
var PI = 3.1415;
var radius = 2;
var circleArea = PI * radius * radius;
var cylinderHeight = 5;
var cylinderVolume = circleArea * cylinderHeight;
var name;
name = "Lee";
console.log(name);
var age = 30;
var person = "Lee";
address = "Seoul";
price = 200;
console.log(address);
console.log(price);
var price = 10;
var tax = 1;
var total = price + tax;
console.log(total);
var x;
console.log(x);
// console.log(y);
var x;
x = 5;
function foo (){}
if (x > 5) {
}
for (var i = 0; i < 10; i++) {
}