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
jQuery example of scroll to top
Image Rollover Using onMouseOver and onMouseOut
Write a function that splits an array into groups the length of size and returns them as a two-dimensional array
How to declare and print value of variable in JavaScript?
What's the difference between let and var?
Get largest number from each sub-arrays