Javascript is_null() Click here to view the is_null() demo (URL: /javascript-is-null-demo.html) There isn't an is_null() function in JavaScript as there is in PHP. Here is a simple is_null() function that you can copy and paste into your JavaScript: The Function Using is_null You can use is_null() right in your JavaScript code, just like you would use it in PHP. In this example, we figure out if the variable age is a null: Code Explanation Check out this one-liner JavaScript function! The null variable in JavaScript is the same as in PHP. This function just returns true if the input equals null.