-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathch10.html
More file actions
41 lines (34 loc) · 1.08 KB
/
Copy pathch10.html
File metadata and controls
41 lines (34 loc) · 1.08 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
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script>
//변수식 선언
var num = 100;
//생성자 함수식 선언
var num = new Number(100);
//형변환
var left = prompt('좌변');
var right = prompt('우변');
alert('결과: ' + (Number(left) + Number(right)));
var kor = prompt('국어');
var math = prompt('수학');
var eng = prompt('영어');
alert(
'결과: ' + ((Number(kor) + Number(math) + Number(eng)) / 3).toFixed(2)
);
var pi = Math.PI;
document.write('올림: ' + Math.ceil(pi) + '<br>');
document.write('내림: ' + Math.floor(pi) + '<br>');
document.write('반올림: ' + Math.round(pi) + '<br>');
var random = Math.random();
alert(random);
var int = Math.floor(Math.random() * 9) + 1;
alert(int);
</script>
</head>
<body></body>
</html>