GithubHelp home page GithubHelp logo

learn-co-curriculum / fe-jquery-simple-calc Goto Github PK

View Code? Open in Web Editor NEW
0.0 18.0 0.0 9 KB

Use jQuery event listeners and JavaScript if/else or switch statement to build a very simple calculator

License: Other

CSS 11.80% HTML 83.37% JavaScript 4.84%

fe-jquery-simple-calc's Introduction

Code Challenge - jQuery Simple Calculator

Students will work in groups to create a simple calculator using jQuery event listeners and JavaScript if/else or switch statements.

Steps

  1. Fork this repository.
  2. CLone Your fork.
  3. cd into the folder for this project.
  4. open index.html in the browser and bring up the JavaScript console.
  5. open the project folder in your code editor.
  6. In js/simple-calc.js write the code neccesary to make a functioning calculator.

The calculator should do the following:

  1. the calculator should store 2 separate numbers as variables.
  2. the calculator should store the operation the user chooses as a variable holding a string: '+', '-', '*', '/'.
  3. when a user clicks increment or decrement buttons it should add one or subtract one from a variable storing that number and update the h2 with a class="number" showing the updated number.
  4. When the user clicks the operation buttons it should change the string that is being stored in the operation variable.
  5. When the user clicks the equals button, the calculator should update a result variable based on the operation choosen and the value of the two numbers. It should then report the result into the h2 with an id="result".

See a live working example of the simple calculator here

Resources

View Code Challenge - jQuery Simple Calculator on Learn.co and start learning to code for free.

fe-jquery-simple-calc's People

Contributors

deniznida avatar fs-lms-test-bot avatar jongrover avatar victhevenot avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fe-jquery-simple-calc's Issues

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.