On getting the result of the following, you can find whether a variable is ‘undefined’. If the result is “false”, it means the variable is undefined.
Here, the variable results in “True”
Example
Live Demo
<html>
<body>
<script>
var res = 10;
if(res) {
document.write("True");
} else {
document.write("False");
}
</script>
</body>
</html>