Skip to content

Commit c4b1f8a

Browse files
committed
Fixed the code's format
1 parent 31c0223 commit c4b1f8a

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
<body>
99
<h1>Section 2: JavaScript Language Basics</h1>
10+
<script src='script.js'></script>
1011
</body>
11-
<script src='script.js'></script>
1212
</html>

script.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
let John = {
2-
fullName : 'John Smith',
3-
mass : 70,
4-
height : 1.9,
5-
calcBIM: function(){
6-
return this.BMI=this.mass/(this.height*this.height);
2+
fullName: 'John Smith',
3+
mass: 70,
4+
height: 1.9,
5+
6+
calcBIM() {
7+
return this.BMI = this.mass / Math.pow(this.height, 2);
78
}
89
}
910

1011
let Mark = {
11-
fullName : 'Mark Doe',
12-
mass : 50,
13-
height : 1.5,
14-
calcBIM: function(){
15-
return this.BMI=this.mass/(this.height*this.height);
16-
}
12+
fullName: 'Mark Doe',
13+
mass: 50,
14+
height: 1.5
1715
}
18-
let highestBMI='John and Mark have the same BMI';
1916

20-
if(John.calcBIM()!==Mark.calcBIM()){
21-
highestBMI = John.BMI>Mark.BMI?John.fullName+" has the highest BMI of "+ John.BMI:Mark.fullName+" has the highest BMI of "+ Mark.BMI;;
17+
let highestBMI = 'John and Mark have the same BMI';
18+
19+
Mark.calcBIM = John.calcBIM;
20+
21+
if (John.calcBIM() !== Mark.calcBIM()) {
22+
23+
highestBMI = John.BMI > Mark.BMI ? John.fullName + " has the highest BMI of " + John.BMI : Mark.fullName + " has the highest BMI of " + Mark.BMI;
2224
}
2325

2426
console.log(highestBMI);

0 commit comments

Comments
 (0)