Many times, I get the values of many things as undefined, generally while parsing strings. What i want to do is, using the if statement, check if a given variable is undefined or not. I've tried the following, but they don't work:
Is there any function sort of thing to check the whether a given variable is defined or undefined...
thanks
| Code: |
|
if(myvar == 'undefined') { //do something } if(myvar == "undefined") { //do something } if(myvar == undefined) { //do something } if(myvar == null) { //do something } |
Is there any function sort of thing to check the whether a given variable is defined or undefined...
thanks
