- 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
truewithfoodInGrams < dayLimitto check whether the amount eaten is less than the daily amount. - Inside the curly brackets of the conditional statement, log the following message:
console.log ('You can eat more!');. - Now set the
foodInGramsvariable to60to see the condition become true.
Comments