- script.js
JavaScript
var foodInGrams = muffin.ask('How many grams of food have you eaten today? Just be honest?');
var dayLimit = 80;
if (foodInGrams < dayLimit) {
console.log('You can eat more!');
} else {
console.log('Not a piece more!');
}
Result
Goalscompleted
Now we need to calculate how much food can be eaten if the amount eaten is less than the daily amount.
- Add declaring of the
foodToEat
variable immediately after thedayLimit
variable is declared. - Replace the logged message
console.log ('You can eat more');
withfoodToEat = dayLimit - foodInGrams;
.
Comments