ez-calc
A super simple calculator function used to complete the freeCodeCamp Calculator project.
The calc
function takes four arguements... and input
string, a totalArr
array (optional), a total
string (optional),
and a clearSet
boolean (optional).
The input
value can be a number,-
, +
, /
, *
, x
, .
, =
, ac
(for All Clear_, c
or clear
(for clear,
which removes the last input. If clear is pressed twice, it's equavalent to All Clear)
To use
; let input = 2;let totalArr = 2 "+" 2 "+";let total = 4;let clearSet = false; const calculator = ;totalArr = calculator0;total = calculator1;clearSet = calculator2;