I am trying to use a function to change an input to what is set within the parameters. The checks work fine in determining if the input is correct, but the don't change the original inputs. I feel like it is something small I am missing, is anyone able to help? Here is my code:
var x = prompt("enter number");
var y = prompt("enter number");
function isThisRowNumberCorrect(number1){
if (isNaN(number1) === true){
alert("Please choose a row number between 0 and 5!");
number1 = prompt("Please choose a row number between 0 and 5.")-'';
}
if (number1 > 5){
alert("Please choose a row number between 0 and 5!");
number1 = prompt("Please choose a row number between 0 and 5.")-'';
}
if (number1 < 0){
alert("Please choose a row number between 0 and 5!");
number1 = prompt("Please choose a row number between 0 and 5.")-'';
}
number1 = number1;
}
function isThisColumnNumberCorrect(number2){
if (isNaN(number2) === true){
alert("Please choose a column number between 0 and 5!");
number2 = prompt("Please choose a column number between 0 and 5.")-'';
}
if (number2 > 5){
alert("Please choose a column number between 0 and 5!");
number2 = prompt("Please choose a column number between 0 and 5.")-'';
}
if (number2 < 0){
alert("Please choose a column number between 0 and 5!");
number2 = prompt("Please choose a column number between 0 and 5.")-'';
}
number2 = number2;
}
isThisRowNumberCorrect(x);
isThisColumnNumberCorrect(y);
console.log(x + "" + y);