- To make an on-screen calculator using JavaScript, HTML, and CSS.
- Marks the completion of the 'Odin Project - Foundations'
https://www.theodinproject.com/lessons/foundations-calculator
- JavaScript
- HTML
- CSS
- Git
- GitHub
- Note use red, blue, borders during draft to identify the containers
- HTML - set up structure HTML layout,
- Set up meta and meta properties in
- Set up CSS link in
- Set up JS link in
- Set up main calculator container in
- Set up inner containers, display, number pad, and credits
- Apply CSS to see high level form of the body, and the num pad.
- One step at a time - refine the num pad look, font size, color contrast,
- Refine the credits at the bottom - text size, center the text, add hovering contrast for link, add transition timing effect.
- Refine the display for numbers
- Add background color to rid blinding white background.
- Start JavaScript - start with what's easy and makes sense.
- JavaScript - tested calculation function, pulling sub operation functions
- Set up global variables to link to HTML elements
- Set up a clear function
- Set up function to
- Set up a function in case if number is greater than our display screen - goes into exponential notation form.
- Set up function to register our events in HTML to JS with buttons.forEach - test with copy and paste from original a) fix buttons entered to display on screen b) fix so that AC actually clears c) fix so that calc actually calculates d) fix so that typing numbers >9 goes into exponential
- Debug issues - test JS with bare minimum skeleton HTML
I created a on-screen Calculator where user is able to perform basic math operations.
Website | Link |
---|---|
CodePen demo | https://codepen.io/iVuDang/full/xxpWOZK |
GitHub demo | https://ivudang.github.io/The-Odin-Project-Calculator/ |
- the spaces between the HTML button element matters I was stuck trying to figure out why the buttons didn't register with the JavaScript functions.
Issue:
- HTML: button> + <button
- JS: operator == '+'
Solution:
- HTML: button>+<button
- JS: operator == '+'
- Refer to '???' noted beside lines in project. Need better understanding.