- script.js
JavaScript
var score = muffin.getScore();
while (score > -1) {
console.log(score);
score = muffin.getScore();
}
Result
Goalscompleted
- On the next line after the variable
score, declare a variabletotal, which equals0. - Inside the loop, replace the statement that logs
scorewith a statement that addsscoretototalusing+=. - After the loop, log the value of the variable
totalin the console.
Comments