Skip to content

Check if a variable exists in JavaScript

Find out how to find out if a variable exists in JavaScript.

 var num = 20;
 if(num !== undefined && num !== null) {
     document.write("Variable 'num' exists");
 }
See also  Subdomain Visit Count - Leetcode Challenge - Python Solution

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.