- script.js
JavaScript
var foodInGrams = 120;
var dayLimit = 80;
Result
Goalscompleted
Let’s start working on the “Can I Eat More?” program.
- After the
dayLimitvariable, add a conditional statement:if(true) { }. - Now replace
truein 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
foodInGramsvaluable with60to make sure that the condition is working.
Comments