/calculator

Basic calculator built with JavaScript

Primary LanguageHTML

Author info

Name

Manon Jacquin

Who am I?

FreeCodeCamp Student

How to reach me?

manon.jacquin@gmail.com

Project overview

JavaScript Calculator

User Story

Objective: Build a CodePen.io app that is functionally similar to this: https://codepen.io/FreeCodeCamp/full/rLJZrA/.

1/ I can add, subtract, multiply and divide two numbers.

2/ I can clear the input field with a clear button.

3/ I can keep chaining mathematical operations together until I hit the equal button, and the calculator will tell me the correct output.

How?

By creating a HTML structure, styling it with CSS and make it work using JavaScript.

Code

Files:

  • index.html file The html file creates the structure of the calculator. It directly connects the button with the onClick method.
  • style.css Styling file.
  • index.js file I created four functions. Each function runs according to a specific button hit.

How to run the program

Using CodePen.io

You can go to https://codepen.io/manonja/pen/EbYrrN to use the calculator.