/The-Odin-Project-Calculator

I created a calculator, & completed Odin Foundations. | Skills: JavaScript, DOM, HTML, CSS.

Primary LanguageJavaScript

The-Odin-Project-Calculator

Purpose:

  • To make an on-screen calculator using JavaScript, HTML, and CSS.
  • Marks the completion of the 'Odin Project - Foundations'

Instructions

https://www.theodinproject.com/lessons/foundations-calculator

Preview:

Technologies:

  • JavaScript
  • HTML
  • CSS

Tools

  • Git
  • GitHub

Process

  • Note use red, blue, borders during draft to identify the containers
  1. HTML - set up structure HTML layout,
  2. Set up meta and meta properties in
  3. Set up CSS link in
  4. Set up JS link in
  5. Set up main calculator container in
  6. Set up inner containers, display, number pad, and credits
  7. Apply CSS to see high level form of the body, and the num pad.
  8. One step at a time - refine the num pad look, font size, color contrast,
  9. Refine the credits at the bottom - text size, center the text, add hovering contrast for link, add transition timing effect.
  10. Refine the display for numbers
  11. Add background color to rid blinding white background.
  12. Start JavaScript - start with what's easy and makes sense.
  13. JavaScript - tested calculation function, pulling sub operation functions
  14. Set up global variables to link to HTML elements
  15. Set up a clear function
  16. Set up function to
  17. Set up a function in case if number is greater than our display screen - goes into exponential notation form.
  18. 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
  19. Debug issues - test JS with bare minimum skeleton HTML

Outcome ✅

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/

Summary

What I learned

  1. 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 == '+'

What could be improved

  • Refer to '???' noted beside lines in project. Need better understanding.