/calculator

A raw javascript calculator implementation

Primary LanguageJavaScript

A Javascript Calculator

Implemented with respect to the following criterion:

  1. No use of eval().
  2. Vanilla javascript (ES5) only.

The implementation uses regex recursively against the key-input.

There is a no-number-coercion branch which contains a (more convoluted) implementation with the additional constraint of not coercing numbers to strings and vice versa (except for final display).

Demo

See it in action here.

Tests

E2E style tests with jasmine & karma. Key-input is tested against the expected screen output. Bug reports welcome.

Credits

All credit to @GeoffStorbeck for the design and its implementation. This was a FreeCodeCamp zipline exercise.