Skip to content

Commit 32c1eba

Browse files
committed
Refactor: rename computeHighScore() -> computeMaximum().
1 parent 8dc59c4 commit 32c1eba

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scratch/chapter4/bubble.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
printScores(scores, prices);
2121

2222
console.log("Quantity Bubbles tests: " + scores.length);
23-
console.log("Highest bubble score: " + computeHighScore(scores) );
23+
console.log("Highest bubble score: " + computeMaximum(scores) );
2424
console.log("Highest scoring solutions: " +
2525
indexesOfLargestNumbers(scores) );
2626
console.log("Cheapest of highest scoring solutions: " +
@@ -30,13 +30,13 @@
3030

3131

3232

33-
function computeHighScore(scores){
33+
function computeMaximum(arrayOfNumbers){
3434

3535
var maximum = 0;
36-
for (var i = 0; i < scores.length; i++) {
36+
for (var i = 0; i < arrayOfNumbers.length; i++) {
3737

38-
if (scores[i] > maximum) {
39-
maximum = scores[i];
38+
if (arrayOfNumbers[i] > maximum) {
39+
maximum = arrayOfNumbers[i];
4040
}
4141
}
4242

@@ -58,7 +58,7 @@
5858

5959
function printScores(scores, prices) {
6060

61-
var highScore = computeHighScore(scores);
61+
var highScore = computeMaximum(scores);
6262

6363
// print the scores
6464
for (var i = 0; i < scores.length; i++) {
@@ -71,7 +71,7 @@
7171

7272
var indexes = [];
7373

74-
var maximum = computeHighScore(scores);
74+
var maximum = computeMaximum(scores);
7575

7676
// find the indexes having that highest score
7777
for (var i = 0; i < arrayOfNumbers.length; i++) {

0 commit comments

Comments
 (0)