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  Anagram - Hackerrank Challenge - Java Solution

Leave a Reply

Your email address will not be published. Required fields are marked *

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