To check a variable is ‘undefined’, you need to check using the following. If the result is “false”, it means the variable is not defined. Here, the variable results in “True” −
Example
Live Demo
<html>
<body>
<script>
var points = 100;
if(points){
document.write("True");
}else{
document.write("False");
}
</script>
</body>
</html>