How do I check for null values in JavaScript?

JavascriptWeb DevelopmentFront End Technology

To check for null values in JavaScript, you need to check the variable value with null. Use the JavaScript strict equality operator to achieve this.


You can try to run the following code to check whether the value of the variable is null or not −

      <title>JavaScript Strict Equality Operator</title>
         var a = 10;
         if(a === null) {
            document.write("Value is null");
         } else {
            document.write("Value is not null");
Published on 16-Feb-2018 08:30:17