Underscore.js _.isUndefined() Function Last Updated : 01 Aug, 2023 Comments Improve Suggest changes Like Article Like Report _.isUndefined() function: It checks if the parameter passed to it is undefined or not. If the parameter passed is undefined the it return true otherwise it returns false. We can even pass window elements to it. Syntax:_.isUndefined(value) Parameters:It takes only one argument which is the value or the variable that needs to be checked. Return value:It returns true if the value or parameter passed is undefined or else it returns false. Examples: Passing a variable to the _.isUndefined() function:The _.isUndefined() function takes the parameter passed to it. So, here it will check the variable 'a' which is passed. Since the value of 'a' is defined earlier as 10, so, it is a defined variable. Hence, the output will be false. html <!-- Write HTML code here --> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script type="text/javascript"> var a=10; console.log(_.isUndefined(a)); </script> </body> </html> Output: Passing a number to the _.isUndefined() function:If we pass a number to the _.isUndefined() function then it checks whether that number is undefined or not. Since, we know all numbers are defined already. Therefore, the answer will be false. html <!-- Write HTML code here --> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script type="text/javascript"> console.log(_.isUndefined(10)); </script> </body> </html> Output: Passing "undefined" to _.isUndefined() function:The _.isUndefined() function takes the element passed to it which is "undefined" here. Since the parameter passed is undefined, therefore the output will be true. html <!-- Write HTML code here --> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script type="text/javascript"> console.log(_.isUndefined(undefined)); </script> </body> </html> Output: Passing missingVariable to the _.isUndefined() function:Here we are passing 'window.missingVariable' as a parameter. But here we have not defined any variable. So the missingVariable has no value. And hence, it is undefined. The output is true. html <!-- Write HTML code here --> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script type="text/javascript"> console.log(_.isUndefined(window.missingVariable)); </script> </body> </html> Output: NOTE: These commands will not work in Google console or in firefox as for these additional files need to be added which they didn't have added. So, add the given links to your HTML file and then run them. The links are as follows: html <!-- Write HTML code here --> <script type="text/javascript" src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js"> </script> Comment More infoAdvertise with us Next Article Underscore.js _.isUndefined() Function S Sakshi98 Follow Improve Article Tags : Misc JavaScript Web Technologies JavaScript - Underscore.js Practice Tags : Misc Similar Reads Underscore.js _.isFinite() Function The _.isFinite() function is used to check whether the value of the parameter passed is finite or not. If the parameter has an infinite value the output is false otherwise, true. We can even perform any operation like addition, subtraction in this function. Syntax:_.isFinite(object) Parameters:It ta 3 min read Underscore.js _.isFunction() Function The _.isFunction() function is used to check whether the given object is function or not. It returns a Boolean value True if the given object is a function and returns False otherwise. Syntax: _.isFunction( object ) Parameters: This function accepts single parameter as mentioned above and described 1 min read Underscore.js _.isNaN() Function _.isNaN() function:Â It is used to find whether the value of the object passed is NaN or not.If the object's value is NaN then the output will be true otherwise, it will be false.We can even perform addition, subtraction etc operations in this function. Syntax:Â _.isNaN(object) Parameters:It takes o 3 min read Underscore.js _.isSet() Function Underscore.js is a library in javascript that makes operations on arrays, string, objects much easier and handy. _.isSet() function is used to check whether the given object is javascript set or not. When linking the underscore.js CDN The "_" is attached to the browser as global variable. Syntax: _. 2 min read Underscore.js _.isDataView() Function Underscore.js is a JavaScript library that provides a lot of useful functions that help in the programming in a big way like the map, filter, invoke, etc even without using any built-in objects. The _.isDataView() function is an inbuilt function in Underscore.js library of JavaScript which is used t 1 min read Like