Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

46 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

calculator

Live preview can be found here.

A calculator that has 1 plus 2 equals 3 on the screen.

Overview

This is a fully functional web-based calculator built as the final milestone for The Odin Project’s Foundations path. It was designed to handle everyday math and built to prevent errors and handle complex sequences without crashing.

Instead of just using basic math functions, I built a system that manages the calculation state in the background. This allows the calculator to remember your previous result while you start a new operation, just like a physical calculator would.

How to use

Basic Math

Click any numbers followed by an operator and the equals sign to get your result.

Chaining Operations:

You don't have to hit equals every time. If you type 5 + 5 +, it will automatically calculate 10 and let you keep adding.

Correcting Mistakes

Backspace (C): Click the backspace button to remove the last digit you typed if you made a mistake.

Clear (AC): Use the clear button to wipe everything and start a completely fresh calculation.

Large Results

If your answer is too long for the display, it will switch to scientific notation so it doesn't run off the edge of the screen.

Learning outcomes

As the final project for The Odin Project’s Foundations path, I tried to use most of what I've learned so far in HTML, CSS, and JavaScript.

I built it by keeping track of numbers and symbols behind the scenes so the calculator always knows what to do next. I also wrote special rules to stop common mistakes, like typing two decimals at once, being able to erase a digit from the answer, or breaking the app by dividing by zero.

To keep the display clean, I added scientific notation for huge results. I also made sure the calculator could chain multiple operations together and reset instantly with a clear button, making it feel smooth and easy to use.

Future improvement plans

  • Add keyboard support

Attributions

Font by Style-7 from fontspace

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages