The idea to create a fitness webpage came from the usual springtime thought: "I really need to get back in shape." The page allows it's user to add a title, the date, how long a user worked out for, how many calories they ate and any notes they may have for the day. The app not only is able to store these notes through a page refresh but edit or delete any notes.  Additionally the page will inform the user if they've partaken in any generally unhealthy habits. 
The form data is neatly packed into an array, which is then stored into another,  
"main" array. The data of the main array, which now contains the user notes, is then copied to the browser's local storage. Upon a refresh, an IF statement is used to detect if the local storage has any data. If it does, it will overwrite the empty main array with that of the local storage copy.
Detecting unhealthy user inputs is accomplished through an else if function. For example, if a user inputs that their daily exercise was below 20 minutes, the function would flag the data as "hazardous". This tag has a CSS tag to give it a clouded border. 

You may also like

Back to Top