Skip to content

barbaraaliverti/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator

This is a solution to the Calculator challenge. FreeCodeCamp is a platform to to help people learn to code for free.

Table of contents

Overview

The challenge

Build a functional calculator using JavaScript and a front-end framework. The user should be able to:

  • Add, subtract, multiply and divide a chain of numbers of any length, and when they hit =, the correct result should be shown
  • When inputting numbers, my calculator should not allow a number to begin with multiple zeros
  • Perform any operation (+, -, *, /) on numbers containing decimal points

Screenshot

image

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • A little bit of Bootstrap
  • React - JS library

How to run this project locally

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run: npm install

then

npm start

Runs the app in the development mode. Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits. You will also see any lint errors in the console.

What I learned

The logic for this project was challenging, but I tried to come up with my own solution and keep my code as clean as I could. I used class based components and I feel I really learned a lot about how React works after this project.

Continued development

Although I learned a lot with this project, I would like to redo it using React hooks in the future. I would also like to add a feature that I noticed almost all calculators have these days, which makes it easier to use %. For example, take 100 - 10%. My calculator would show 99.9 as 10% alone is 0.1, whereas a smartphone calculator usually deducts that the user wants to know what 100 minus 10% of 100 is and shows 90 as a result.

Author

About

A lovely calculator built with React :)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published