Giter Club home page Giter Club logo

vanilla-js-calculator's Introduction

Simple JavaScript Calculator

Overview

This is a simple calculator built with HTML, CSS and Vanilla Javascript that provides basic functionality. image

This calculator project is hosted here.

Functionality

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 to 1);
  • 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 -)).

Execution

  1. Clone the repository
    git clone https://github.com/SofiiaTrokhymchuk/vanilla-js-calculator.git
  2. Open index.html or run on VS Code using Live Server plugin.

Contributing

Contributions are welcome. If you have a suggestion to make this project better, please:

  1. Fork the project;
  2. Create your branch:
git checkout -b <suggestion-branch-name>
  1. Commit your changes:
git commit -m 'Add/Fix something'
  1. Push to your branch:
git push origin <suggestion-branch-name>
  1. 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!

vanilla-js-calculator's People

Contributors

sofiiatrokhymchuk avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.