From 0e3c581863cab27460f5c94622e6f2f4c9fe1108 Mon Sep 17 00:00:00 2001 From: jess2896 Date: Wed, 25 Sep 2019 12:03:46 -0400 Subject: [PATCH 1/3] Calculates if Mark's BMI is higher than John's --- index.html | 4 +++- script.js | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 script.js diff --git a/index.html b/index.html index 975ef26..03fd62a 100644 --- a/index.html +++ b/index.html @@ -8,4 +8,6 @@

Section 2: JavaScript Language Basics

- \ No newline at end of file + + + diff --git a/script.js b/script.js new file mode 100644 index 0000000..9e50a56 --- /dev/null +++ b/script.js @@ -0,0 +1,12 @@ +let markMass = 70; +let markHeight = 1.70; +let johnMass = 50; +let johnHeight = 1.90; + +function calculateBMI(mass,height) { + return mass/(height*height); +} + +let isMarkHigherBMI = calculateBMI(markMass,markHeight)>calculateBMI(johnMass,johnHeight); + +console.log("Is Mark's BMI higher than John's? "+isMarkHigherBMI); From d2c31b637ec187b3fc56316b42f498f0215bcf58 Mon Sep 17 00:00:00 2001 From: jess2896 Date: Mon, 30 Sep 2019 10:58:39 -0400 Subject: [PATCH 2/3] Fixed some spaces in the code --- script.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index 9e50a56..a1b3be8 100644 --- a/script.js +++ b/script.js @@ -2,11 +2,10 @@ let markMass = 70; let markHeight = 1.70; let johnMass = 50; let johnHeight = 1.90; +let isMarkHigherBMI = calculateBMI(markMass, markHeight) > calculateBMI(johnMass, johnHeight); -function calculateBMI(mass,height) { - return mass/(height*height); +function calculateBMI(mass, height) { + return mass / Math.pow(height, 2); } -let isMarkHigherBMI = calculateBMI(markMass,markHeight)>calculateBMI(johnMass,johnHeight); - -console.log("Is Mark's BMI higher than John's? "+isMarkHigherBMI); +console.log("Is Mark's BMI higher than John's ? " + isMarkHigherBMI); From 6d9995f724892ab4e18a457577c27860b0b55976 Mon Sep 17 00:00:00 2001 From: jess2896 Date: Mon, 7 Oct 2019 11:06:55 -0400 Subject: [PATCH 3/3] Fixed some variable declarations and index --- index.html | 2 +- script.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 03fd62a..9ce1522 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@

Section 2: JavaScript Language Basics

+ - diff --git a/script.js b/script.js index a1b3be8..7dfa13b 100644 --- a/script.js +++ b/script.js @@ -1,7 +1,7 @@ -let markMass = 70; -let markHeight = 1.70; -let johnMass = 50; -let johnHeight = 1.90; +const markMass = 70; +const markHeight = 1.70; +const johnMass = 50; +const johnHeight = 1.90; let isMarkHigherBMI = calculateBMI(markMass, markHeight) > calculateBMI(johnMass, johnHeight); function calculateBMI(mass, height) {