Giter Club home page Giter Club logo

calc's Introduction

frontEnd

This calculator is my first project in javascript (10/9-10/10/22). It attempts to mimic the standard OSX calculator (in non-scientific mode). It was inspired by FrontEndMasters intro to web development course with Brian Holt.

The calculator can basically be seen as doing logic on an ordered list on characters.

There is some back-end logic (which determines when and how to do a 'calculation') and front-end logic (which controls the display).

Back-end: The required conditions to 'calculate' are fufilled when the final characters in the input string have the following pattern: (number,operator, number,operator || equals). Without this information, the calculator doesn't know how to interpret equals or an operator. (number,operator,number) 'primes' the calculator to calculate. Operator or equals, both trigger a calculation.

Front-end is fairly straightforward. It has some logic to prevent leading zeros or multiple decimal points. It concatenates the string, unless the previous input was operator or equals, in which case it clears the display and starts fresh.

There is some awkward code here that I will hopefully revise when I understand JS better.

  1. How can I revert the initial variables inside the calc object to their initial state?
  2. The logic is a bit hard to understand for the reader. How can I break this up to be clearer?

calc's People

Contributors

dlesky 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.