Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 69a8da2

Browse files
src: Add solution to Coding Challenge 1
1 parent 9dc0840 commit 69a8da2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎src/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JavaScript Tutorials</title>
6+
</head>
7+
8+
<body>
9+
<h1>TEST PAGE</h1>
10+
</body>
11+
12+
<script src="index.js"></script>
13+
</html>

‎src/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
// -----------------------------------------------------------------------------
3+
// Coding Challenge 1
4+
// -----------------------------------------------------------------------------
5+
6+
var markMass = Number(prompt("What is Mark's mass?"));
7+
var markHeight = Number(prompt("What is Mark's height?"));
8+
var markBMI = markMass / (markHeight ** 2);
9+
console.log("Mark's BMI: " + markBMI);
10+
11+
var johnMass = Number(prompt("What is John's mass?"));
12+
var johnHeight = Number(prompt("What is John's height?"));
13+
var johnBMI = johnMass / (johnHeight ** 2);
14+
console.log("John's BMI: " + johnBMI);
15+
16+
var isMarkBMIGreaterThanJohn = markBMI > johnBMI;
17+
console.log("Is Mark's BMI greater than John's? " + isMarkBMIGreaterThanJohn);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /