#Bonus Assignment Additional assignment to practice interacting with the DOM. (This is what happens when you tell your instructor you finished the weekend homework on Thursday).
See it live at http://sallykingston.me/theDOM/.
This exercise will help you understand how to use JavaScript functions as well as to start interacting with the DOM.
After completing this assignment, you should…
- Understand how JavaScript functions work
- Understand the basics of the DOM (Document Object Model)
After completing this assignment, you be able to effectively use
- Be able to create re-usable functions
- Be able to create HTML elements and interact with them via JavaScript
- A repo containing at least:
main.jsindex.html
- A link to the deployed project
- No JavaScript warnings or errors
-
Use the HTML provided in
index.htmland set up a new project -
Create a
main.jsfile and link it to yourindex.htmlfile -
Using the DOM API and the elements on the page, set up the following:
- You will need to create 4 buttons that will have click events attached to them, of each, they will add, subtract, multiply, and divide respectively, effectively combining the 2 input values entered on the page.
- You'll need to convert the values to a number (think
Number(value)) in order to process them. - Your output should be injected into the answer element
-
Add some styles to this project and make it something pretty to look at.
Taking what you have learned, create the below image in HTML/CSS and add the functionality (JS) you see below.
| Mockup | In Action |
|---|---|
![]() |
![]() |

