Skip to content

LeoUrushi/Three-way-calculator-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Three-way-calculator-javascript

This is a working example of a three-way calculator made only with html and javascript. No jQuery or any other libraries required.

This is a working example of a three-way calculator made only with html and javascript. No jQuery or any other libraries required.

To handle different scenarios, we will use a series of “if” statements.

The calculator consists of three input boxes. If the field A, and ONLY if the field A is left empty, it will calculate it. Repeat the process for the field B and C.

The main function, “doDaMaths” is triggered either on clicking the green “calculate” button or hitting “Enter” key from any one of the input boxes.

To help users figure out how to use it, and to prevent confusion, there are two sets of error messages. If the user hits “Enter” with ALL THREE fields filled out, it says something in the lines of “It looks like you entered all three boxes!”. Another error message is triggered when there was no input saying, “Don’t forget to type in x2 fields”.

The result should. Look something like this:

Image description

Working example: http://calculate-things.com/percent.html

Editable code sample: https://codepen.io/LeoU/pen/BaBPNRr

About

Three-way calculator (Javascript)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published