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
How can I redirect the user from one page to another using jQuery or pure JavaScript?
How to get selected text from a select box using jQuery?
Generate random password for form field on click using JavaScript
jQuery get the coordinates of div clicked
How to the length of the longest word in the provided sentence?
JavaScript simple alert on Click