Well, I am running the following function in my code and wondering why getting an error in Firebug which is as follows:
function TestSurvey(UniqueID, PhontTypes) {
if(typeof(PhontTypes) != "undefined")
PhontTypes = "4";
if (PhontTypes.match("5"))
{
window.location = some url location here...
}
else
{
window.location = some url location here...
}
}
The error I am getting in firebug is as follows:
TypeError: PhontTypes is undefined
if (PhontTypes.match("5"))
PhontTypesundefined? Run aconsole.log(PhontTypes)right before your logic.== "undefined"rather than!= "undefined". As you have it, everything butundefinedis replaced with"4".if(typeof(PhontTypes) != "undefined")toif(typeof(PhontTypes) !== "undefined")?PhontTypesis undefined, it stays undefined. In the event that it is defined, it is replaced by"4". You want to reverse that behavior.!=. You want to check for equality rather than inequality. "if PhontTypes is undefined, set it to"4"instead."