GithubHelp home page GithubHelp logo

calculator's Introduction

Calculator

See the project live: https://lookingcoolonavespa.github.io/calculator/

A calculator app made using:

  • html
  • css
  • vanilla javascript

Notes

I wanted this project to function as close to a real calculator as possible, which introduced some issues. There were a lot of extra conditionals I had to put it to make it work, and I can't even lie, my code suffered for it.

Refactoring took some work because I had some trouble understanding what I was trying to do. Introducting what I call "vehicle variables" (basically variables with boolean values that tell me where I'm at so I can go where I need to go) helped clean things up a lot.

Next time I've gotta do a better job of planning things out because "just try to make it work" code really made my head hurt trying to debug this thing. At the very least, devtools and I have created a much stronger relationship, and I'm thankful for this.

I'm pretty happy with how things turned out. The only thing I'd like to fix is you're not able to select any values in the notepad. Reason for this is because of the way I styled it. I didn't even realise this was going to be issue until I finished. Oh well. Not going to mess with it now. Just too much work and not enough of a payoff. Next time I'm going to use css grid to position everything.

Things I learned

  • local variables are not overwritten when the function is called. Instead, a new set of local variables are created. For example, in the notepad section where your evaluations are outputted, it can output multiple lines simultaneously, and yet the same variables are used to store the number, operator, and answer.

  • if you have a div on top of another div, you won't be able to interact with the bottom div even if there is nothing obscuring it. This can be solved with the css styling pointer-events: none placed on the top div.

  • js is really bad with decimals, I couldn't figure out a way to deal with it

calculator's People

Contributors

nksupermarket avatar

Stargazers

 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.