Question: Write a new program ( HTML , CSS , and JavaScript ) This one should keep track of how many calories you have eaten. It
Write a new program HTML CSS and JavaScript
This one should keep track of how many calories you have eaten.
It should allow the user to enter a food name and a number of calories.
Each time they enter a new item, a food object should be created and added to an array.
Write out the updated contents of the array in the console.log so that you can verify your code is correct
at this point.
Also, in that same click event, you should update a display on the screen that shows the user the total
number of calories they have consumed.
My version creates food items, a banana and hot dog when I first start the program, so you will see
that when I add one item with calories, there are already items in my object list and the calorie
output shows You are not required to do that, but I suggest you do
Tip: in your constructor, use
this.calories parseIntpCalories; that forces the input value to be treated as number, not a string
See screen shots below:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
