The only way to truly test if a variable is undefined is to do the following. Remember, undefined is an object in JavaScript.
<!DOCTYPE html>
<html>
<body>
<script>
if (typeof someVar === 'undefined') {
alert("Your variable is undefined");
}
</script>
</body>
</html>
Most Helpful This Week
Generate random password for form field on click using JavaScript
Check if a string ends with the given target string
jQuery check if an element is visible or hidden
How to build simple tabs with jQuery?
How to change text color on click using JavaScript?
JavaScript check if first string contains all characters of second string