0
Help! I get “ReferenceError: Can't find variable: substractBy at Line: -6” when I try to use the subtract function. Help please!
2 Antworten
+ 1
Check the function name in js code .
+ 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...