Complete MP09
This commit is contained in:
@@ -5,7 +5,7 @@ Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>TODO supply a title</title>
|
||||
<title>Challenge 1</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script type="text/javascript">
|
||||
|
@@ -5,7 +5,7 @@ Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>TODO supply a title</title>
|
||||
<title>Challenge 2</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script type="text/javascript">
|
||||
|
@@ -5,17 +5,17 @@ Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>TODO supply a title</title>
|
||||
<title>Challenge 3</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script type="text/javascript">
|
||||
var age = prompt("Please enter your age.");
|
||||
if (age < 5 & ) {
|
||||
if (age <= 5 & age <= 12) {
|
||||
document.write("Congratulations! Your ticket is free!");
|
||||
} else if (age < 12) {
|
||||
} else if (age <= 12) {
|
||||
document.write("Your ticket costs $5.00.");
|
||||
} else {
|
||||
|
||||
document.write("Your ticket costs $9.00.")
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Challenge 4</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script type="text/javascript">
|
||||
var names = new Array(2);
|
||||
var name;
|
||||
for (let i = 0; i < names.length; ++i) {
|
||||
name = prompt("Give me a name.");
|
||||
names[i] = name;
|
||||
console.log(i);
|
||||
}
|
||||
|
||||
if (names[0].charAt(0) > names[1].charAt(0)) {
|
||||
var tmp = names[0];
|
||||
names[0] = names[1];
|
||||
names[1] = tmp;
|
||||
}
|
||||
|
||||
for (let i = 0; i < names.length; ++i) {
|
||||
document.write(names[i] + "</br>");
|
||||
console.log(names[i]);
|
||||
console.log(typeof(names[i]));
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user