-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction_13.html
More file actions
37 lines (31 loc) · 1.03 KB
/
function_13.html
File metadata and controls
37 lines (31 loc) · 1.03 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
function TestScore(name, kor, eng){
this.userName = name;
this.korNum = kor;
this.engNum = eng;
}
TestScore.prototype.getTestInfo = function(){
document.write("이름: " + this.userName + "<br>");
document.write("국어: " + this.korNum + "<br>");
document.write("영어: " + this.engNum + "<br>");
}
TestScore.prototype.getAvg = function(){
return (this.korNum + this.engNum) / 2;
}
var kimgun = new TestScore("김군",80,90);
var ohgun = new TestScore("오군",100,80);
kimgun.getTestInfo();
document.write("평균 점수" + kimgun.getAvg(),"<br><br>");
ohgun.getTestInfo();
document.write("평균 점수" + ohgun.getAvg(),"<br><br>");
</script>
</head>
<body>
</body>
</html>