-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction_10.html
More file actions
48 lines (45 loc) · 1.53 KB
/
function_10.html
File metadata and controls
48 lines (45 loc) · 1.53 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
42
43
44
45
46
47
48
<!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 CheckWeight(name,height,weight){
this.userName = name;
this.userWeight = weight;
this.userHeight = height;
this.minWeight;
this.maxWeight;
}
CheckWeight.prototype.getInfo = function(){
var str = "";
str += "이름: " + this.userName + ", ";
str += "키: " + this.userHeight + ", ";
str += "몸무게: " + this.userWeight + "<br>";
return str;
}
CheckWeight.prototype.getResult = function(){
this.minWeight = (this.userHeight - 100) * 0.9 - 5;
this.maxWeight = (this.userHeight - 100) * 0.9 + 5;
if(this.userWeight >= this.minWeight && this.userWeight <= this.maxWeight){
return "정상 몸무게입니다";
}
else if(this.userWeight < this.minWeight){
return "정상 몸무게보다 미달입니다.";
}
else{
return "정상 몸무게보다 초과입니다.";
}
}
var jang = new CheckWeight("장보리", 168, 62);
var park = new CheckWeight("박달재", 180, 88);
console.log(jang);
console.log(park);
document.write(jang.getInfo());
document.write(park.getInfo());
</script>
</head>
<body>
</body>
</html>