Skip to content

Commit 2aea1b5

Browse files
committed
updating code
1 parent 91f7c70 commit 2aea1b5

File tree

11 files changed

+65
-11
lines changed

11 files changed

+65
-11
lines changed

chapter2/battleship.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>Battleship</title>
54
<meta charset="utf-8">
5+
<title>Battleship</title>
66
</head>
77
<body>
88
<h1>Play battleship!</h1>

chapter4/bubbles2.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,22 @@
1818

1919
var highScore, bestSolutions;
2020

21+
//
2122
// compute the high score and display results
23+
//
2224
highScore = printAndGetHighScore(scores);
2325
console.log("Bubbles tests: " + scores.length);
2426
console.log("Highest bubble score: " + highScore);
2527

28+
//
2629
// compute the best solutions and display
30+
//
2731
bestSolutions = getBestResults(scores, highScore);
2832
console.log("Solutions with the highest score: " + bestSolutions);
2933

34+
//
3035
// compute the most cost effective of the best solutions
36+
//
3137
mostCostEffective = getMostCostEffectiveSolution(scores, costs, highScore);
3238
console.log("Bubble Solution #" + mostCostEffective + " is the most cost effective");
3339

@@ -56,7 +62,7 @@
5662

5763

5864
function getMostCostEffectiveSolution(scores, costs, highscore) {
59-
var cost = 100.0;
65+
var cost = 100.00; // much higher than any of the costs
6066
var index;
6167

6268
for (var i = 0; i < scores.length; i++) {

chapter5/autoomatic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>Object-o-matic</title>
54
<meta charset="utf-8">
5+
<title>Object-o-matic</title>
66
<script>
77
function makeCar() {
88
var makes = ["Chevy", "GM", "Fiat", "Webville Motors", "Tucker"];

chapter5/carProps.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Car properties</title>
6+
<script>
7+
8+
var fiat = {
9+
make: "Fiat",
10+
model: "500",
11+
year: 1957,
12+
color: "Medium Blue",
13+
passengers: 2,
14+
convertible: false,
15+
mileage: 88000,
16+
started: false,
17+
18+
start: function() {
19+
this.started = true;
20+
},
21+
22+
stop: function() {
23+
this.started = false;
24+
},
25+
26+
drive: function() {
27+
if (this.started) {
28+
alert(this.make + " " +
29+
this.model + " goes zoom zoom!");
30+
} else {
31+
alert("You need to start the engine first.");
32+
}
33+
}
34+
};
35+
36+
fiat.start();
37+
fiat.drive();
38+
39+
for (prop in fiat) {
40+
console.log(prop + ": " + fiat[prop]);
41+
}
42+
43+
</script>
44+
</head>
45+
<body>
46+
</body>
47+
</html>
48+

chapter5/carWithDrive.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>Car with drive</title>
54
<meta charset="utf-8">
5+
<title>Car with drive</title>
66
<script>
77

88
var fiat = {

chapter5/carWithDriveExercise.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>All cars driving</title>
54
<meta charset="utf-8">
5+
<title>All cars driving</title>
66
<script>
77

88
var fiat = {

chapter5/carWithFuel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>Car with fuel</title>
54
<meta charset="utf-8">
5+
<title>Car with fuel</title>
66
<script>
77

88
var fiat = {

chapter5/eightball.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>Magic Eightball</title>
54
<meta charset="utf-8">
5+
<title>Magic Eightball</title>
66
<script>
77

88
var eightBall = {

chapter5/prequal.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
//
6767
// add a function to make it easier to generate the console output!
6868
//
69-
function isWorthALook(b, car) {
70-
if (b) {
69+
function isWorthALook(didQualify, car) {
70+
if (didQualify) {
7171
console.log("You gotta check out this " + car.make + " " + car.model);
7272
} else {
7373
console.log("You should really pass on the " + car.make + " " + car.model);

chapter5/secret.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>Secret</title>
54
<meta charset="utf-8">
5+
<title>Secret</title>
66
<script>
77

88
function getSecret(file, secretPassword) {

0 commit comments

Comments
 (0)