I have a following task from my mentor:
Type a value with a prompt and make it a number with unary plus
console.log if it's even or odd
If it's not a number, add another console log
Here's the code I have right now, and I can't really understand what's wrong:
x = prompt("Enter your value: ");
if(x % 2 === 0) {
console.log("x is an even number");
} else {
console.log("x is an odd number")
}
if (typeof x === "!Number"){
console.log("Whoops, it seems like you're mistaken");
}
typeof xand will find it is always '"string"'