File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 11let 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
1011let 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
2426console . log ( highestBMI ) ;
You can’t perform that action at this time.
0 commit comments