MCPcopy Create free account
hub / github.com/codemistic/Web-Development / evaluate

Function evaluate

js-calculator/script.js:22–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21
22function evaluate(){
23 let exp = calculationText.innerText.split(/[+\-\×\÷\%]/,2)
24 let num1 =exp[0]
25 let num2 = exp[1]
26 switch(calculationText.innerText[num1.length]){
27 case '+': operand = add;break
28 case '-': operand = subtract;break
29 case '×': operand = mult; break
30 case '÷': operand = divide; break
31 case '%': operand = percent; break
32 }
33 result = operand(parseFloat(num1),parseFloat(num2))
34 updateResult(result)
35 calculated = true
36}
37const modeAdd = 0;
38const modeRem = 1;
39function updateCalculation(character, mode){

Callers 1

script.jsFile · 0.85

Calls 1

updateResultFunction · 0.85

Tested by

no test coverage detected