How do I make it say something when the person types in something other than a number?


#1

confirm("Want to find the area of a square?");
var z = prompt("Please type in your number");

var squarea = function (x){

if (g === false){
console.log(x * x);
} else {
console.log("That's not a number");
}
};
squarea(z);

confirm("Want to find the perimeter of a square?");
var t = prompt("Please type in your number");
var squarep = function (x){
if (g === false){
console.log(x * 4);
} else {
console.log("That's not a number");
}
};
squarep(t);


#2

you can try something like this

var z = prompt("Please type in your number");


while(isNaN(parseInt(z,10))){
    console.log("Please be sure type in a number");
    z = prompt("Please type in your number");
}

or

while(!(parseInt(z,10) && parseFloat(z,10))){
     console.log("Please be sure type in a number")
    z = prompt("Please type in your number");
}

#3

by the way you have a error in your code unless this is not all of it
'g' is not defined anywhere