So i'm working on a side project, a HTML game. The user has 3 buttons to choose from, when they click one it sets an input fields value to that number
I am having trouble with the validation portion of it. I'm very new to javascript so please don't laugh if its a very stupid problem XD.
I've started writing a function it is posted below
function Check() {
var UserInput1 = document.forms["calculator"]["userInput1"];
var UserInput2 = document.forms["calculator"]["userInput2"];
var result;
function Sum(Uval1, Uval2) {
return Uval1 + Uval2;
}
var result = Sum(UserInput1, UserInput2);
console.log('User Input 1 = ', UserInput1);
console.log('User Input 2 = ', UserInput2);
console.log('Result = ', result);
}
I want the function to add the 2 user inputs and validate that they are equal to another preset variable in my JS file