This is a simple calculator built with HTML, CSS and Vanilla Javascript that provides basic functionality.
This calculator project is hosted here.
This calculator supports basic arithmetic operations and functionality such as:
- addition (+);
- subtraction (-);
- multiplication (*);
- division (/);
- modular division (%);
- clear all (AC);
- delete (DEL).
The calculator makes a basic check to see if the expression entered by the user is correct and controls user input:
- it ensures that there are no leading zeros (e.g.,
01
is corrected to1
); - multiple consecutive dots are not allowed (e.g., invalid input like
0...1..0
is prevented); - it checks the parity of the entered parentheses (e.g., invalid input like
())(
is prevented); - input of opening
(
paratheses right after)
,.
and numbers is prevented; - input of closing
)
paratheses right after(
,.
and arithmetic operations symbols is prevented; - input of arithmetic operations symbols right after
(
is prevented (except-
)).
- Clone the repository
git clone https://github.com/SofiiaTrokhymchuk/vanilla-js-calculator.git
- Open
index.html
or run on VS Code using Live Server plugin.
Contributions are welcome. If you have a suggestion to make this project better, please:
- Fork the project;
- Create your branch:
git checkout -b <suggestion-branch-name>
- Commit your changes:
git commit -m 'Add/Fix something'
- Push to your branch:
git push origin <suggestion-branch-name>
- Open a Pull Request.
You can also create an issue with bug
or enhancement
tag. Please, give this project a star if you like it. Thank you!