Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
My program on startup:
My program just before I click Submit:
My program after clicking to add item:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started