This is a simple calculator application built with HTML, CSS, and JavaScript. It provides basic arithmetic operations like addition, subtraction, multiplication, and division.
You can view a live demo of the calculator here.
- Addition, subtraction, multiplication, and division operations
- Responsive design for various screen sizes
- User-friendly interface
- Light mode and dark mode
To get a local copy up and running, follow these simple steps:
- Clone the repository
git clone https://github.com/Wambita/js-calculator.git
- Open the
index.html
file in your favorite browser.
- Open the
index.html
file in a web browser. - Use the calculator buttons to perform calculations.
- HTML
- CSS
- JavaScript
The CSS file includes styles for the calculator's layout and appearance. Media queries are used to ensure the calculator is responsive on screens below 550px width.
body
: Styles for the overall page, including flexbox layout and background color.h2
: Styles for the header, including font size, color, and decoration.#calculator
: Styles for the calculator container, including background color and border radius.#display
: Styles for the display area of the calculator, including padding, font size, and background color.#keys
: Styles for the grid layout of the calculator buttons.button
: Styles for the buttons, including size, color, and hover/active states..operator-btn
: Additional styles for operator buttons.
Has 3 functions:
-
appendToDisplay()
it displays the numbers that have been input and operand to the display so as to view the equation. -
clearDisplay()
- it clears the display so that a new equation can be added -
calculte()
- does the calculation of the problem usingeval
function and also has error handling to catch errors
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.