I have defined a javascript variable but it returns undefined.
variable = "";
if(somecondition){
variable=myString.length;
}
alert(variable);
here variable returns undefined. If I keep the alert inside the if condition, I am able to get the value but its not working if I keep the alert outside the if condition.
No comments:
Post a Comment