alexflorides / javascript-calculator Goto Github PK
View Code? Open in Web Editor NEWA simple calculator built using HTML, CSS and JavaScript
Home Page: https://alexflorides.github.io/javascript-calculator/
License: MIT License
A simple calculator built using HTML, CSS and JavaScript
Home Page: https://alexflorides.github.io/javascript-calculator/
License: MIT License
Noticed that, on this application, taking the square root of -1 resulted in NaN, as JavaScript would naturally evaluate it to.
Although most simple calculator applications do this, perhaps it would be a good idea to extend the calculator's abilities to operations with imaginary & complex numbers, or at least simple operations such as square root of negative numbers and arithmetic with complex numbers.
Of course, simple arithmetic with complex numbers would require an alternative functionality that differentiates them from real numbers, such as an "i" button.
This is effectively and efficiently possible using the math.js library.
In the Windows Calculator we have a very useful function to verify if our input was correct.
Whenever you activate an operator it puts the number and the operator above the display with smaller letters.
Even if the full history is not preserved like in Windows Calculator, just showing the last operation helps a lot to the user to see what he has calculated.
The history of the operation displays outside the dashboard. For example, when I type 8 + 8, it displays outside the dashboard. Only the answer displays inside the dashboard
1/x and +/- functions make any calculator much more usable and they are not hard to implement.
Behaviourally, the percent button doesn't work as it does on iOS. An issue seen when trying:
I think it's width size we cn be increased for pc/desktop size and phone size is good and apply shadow for make a more interactive.
You can already copy the result number from the output field.
It would be great if you could paste in as well (not appending to the existing number but overwriting it).
With this you can skip the implementation of the memory functions, since the clipboard can be used in almost all cases instead.
Some countries use dot, others use comma as decimal point.
Both comma and dot keys should work on the keyboard as decimal point.
The power of two (x²) and square root (√) are also part of most basic calculators and easy to implement. It would be good to have.
Can i add the MIT licence to the project ?
Hi Alexandros,
You have probably made this calculator to practice programming, but I can tell you that it's the best JavaScript based calculator out there. And I have checked more than 30 different ones...
It's great that the numerical keyboard is working as input, great styling, great exception handling of division by zero. Overall very nice.
I will make a few suggestions on how to improve it further if you are interested in improving it.
BRs
/Andras
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.