Git Product home page Git Product logo

jquery-calculator's Introduction

jQuery Calculator

Use jQuery to build a basic calculator using the provided HTML and CSS.

Example

More specifically, the app should allow a user to do the following.

  • Click an operand or operator button to append its corresponding text to the screen.
    • If the screen displays the message Error, don't append anything.
  • Click the clear button to remove all the text from the screen.
  • Click the equals button to evaluate the arithmetic expression shown in the screen.
    • If the expression is in format operand(+|-|x|÷)operand, evaluate the expression and update the screen with the result.
    • If the expression isn't in the correct format or when attempting to divide by zero, update the screen with the message Error.

Bonus 1

Try to solve the exercise without changing the existing HTML nested inside the buttons-container tag.

Bonus 2

Try to evaluate the expression without using the eval() function.

Bonus 3

Enhance the calculator so users can input arithmetic expressions using their keyboard. More specifically, the app should allow a user to do the following.

  • Type an arithmetic expression directly to the screen.
  • Press the Enter key to evaluate the screen's expression.
  • Press the Escape key to clear the screen.

TIP: You'll have to change the screen to an <input> tag.

Deployment

Review the following articles on the Surge platform and then deploy your website to production.

A good domain name for this project is USERNAME-jquery-calculator.surge.sh where USERNAME is your GitHub username in all lowercase letters. Once deployed and everything works as you expect, copy the URL to your site and paste it below.

PASTE YOUR PRODUCTION URL HERE

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.