- script.js
JavaScript
var foodInGrams = 120;
var dayLimit = 80;
Result
Goalscompleted
Let’s start working on the “Can I Eat More?” program.
- After the
dayLimit
variable, add a conditional statement:if(true) { }
. - Now replace
true
in the condition to checkfoodInGrams < dayLimit
(ate less than the daily amount). - Inside the curly brackets of the conditional statement, log the following message:
console.log ('You can eat more!');
. - Now replace the value of
foodInGrams
valuable with60
to make sure that the condition is working.
Comments