Calculators

By Alex Schaefer

Visual Calculator with JavaScript

This calculator uses the prompt statement to ask the question, and the window.documentln() statement to display the answer to the user.

How it works:

The inputs are JavaScript prompts, and the outputs are writeln() statements.

Some cool features:

  1. The string-to-number conversion.
  2. While loops to force valid inputs.
  3. Life, the universe, and everything

Some notable exceptions:

  1. 0**0 is not allowed. Nor dividing by 0.
  2. Remainder (%) 0 returned Undefined rather than NaN.
  3. String values are not allowed in the numbers boxes.
  4. The operation box only allows it's specific characters, but will, however, allow for 'minus' instead of '-'. (Lowercase only)