0

Help! I get “ReferenceError: Can't find variable: substractBy at Line: -6” when I try to use the subtract function. Help please!

https://code.sololearn.com/W44Igi99MPU8/?ref=app

2nd Mar 2021, 6:09 PM
Sam P.
Sam P. - avatar
2 odpowiedzi
+ 1
Check the function name in js code .
2nd Mar 2021, 6:35 PM
Abhay
Abhay - avatar
+ 1
function name is "subtractBy" not "substractBy" as it was in onclick attribute calling ;) also, in add function you must cast to number the string got from 'value' attribute/property: num1 = +document.getElementById("firstNumber").value; num2 = +document.getElementById("secondNumber").value; Samuel Pedrick edit: if a string is one of operands, then addition result a string in js...
2nd Mar 2021, 6:44 PM
visph
visph - avatar