A simple calculator using HTML, SCSS and JavaScript. You can test the calculator at:
https://kris-martin.github.io/calculator/
- +, -, ÷, x operators
- pressing on/c clears the screen and resets the calculator
- handles decimals
- calculates results of operations 2 numbers at a time and updates screen
- can chain operators together eg. 8 x 8 + 7 - 2 = 69.
- the calculator first calculates the result of the first 2 numbers, then of the result and the next number and so on...
- pressing equal returns a result
- a result is also shown after two numbers are entered with an operator
- if one number is entered, then an operator, and then equals, it returns the result of: num operator num - eg. if num = 12 and operator = x then it calculates 12 x 12 = 144.
- formats results to fit within 9 digit display
- can only press equals once.
- % button
- square root button
- +/- assign positive/negative to number
- CE button
- pressing equal again repeats the last operation
-
Create a README.md on your Calculator repository that includes a picture of the design you will be reproducing
Image of calculator to reproduce - source
-
Using HTML + SCSS, recreate the design that you chose
-
Create a calculator to be rendered to the html page
-
it should have number keys from 0 to 9
-
It should have operator keys (+, -, /, *, =)
-
It should also have a “.” key
-
It should have a display rendering the current calculation in a box at the top
-
Should render the current calculation in a box at the top (calculator display)
-
It should handle decimals
-
It doesn’t need to support order of operation
-
It should not use eval() or Function() constructor
-
Make sure to keep your functions separated from the JS DOM interaction code.