I'm struggling with this small code snippet that is supposed to check if a variable is a number, but it doesn't seem to be working correctly.
var cost_value = 7777;
alert(cost_value);
if (typeof(cost_value) !== "number") {
alert("not a number");//7777
} else {
alert("a number");
}
No matter what, it always alerts as "not a number".
Trying to change it to if(jQuery.type(cost_value) !== "number"
Unfortunately, the modification doesn't work either. Any suggestions?