Underscore.js _.isError() Function Last Updated : 25 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Underscore.js is a library in javascript that makes operations on arrays, string, objects much easier and handy. _.isError() function is used to check whether the given object is javascript Error Object or not. Note: It is very necessary to link the underscore CDN before going and using underscore functions in the browser. When linking the underscore.js CDN The "_" is attached to the browser as a global variable. Syntax: _.isError(object); Parameters: It takes only one parameter i.e object. Returns: It returns the boolean value. If the object is a inherit from Error object of javascript it returns true otherwise false is returned by the function. Few Examples are given below for a better understanding of the function. Example 1: When error is created from error object html <!DOCTYPE html> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script> let e=new Error() let ans=_.isError(e) console.log(_.isError(e)) if(ans) console.log("It is the javascript error") </script> </body> </html> Output: Example 2: When try catch is used to throw error. html <!DOCTYPE html> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script> let e; try{ alrt("GeeksforGeeks") } catch(e){ let ans=_.isError(e) console.log(`Error is ${e}`) console.log(_.isError(e)) if(ans) console.log("It is the javascript error object") } </script> </body> </html> Output: Example 3: When given error is string type. html <!DOCTYPE html> <html> <head> <script src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js" > </script> </head> <body> <script> let e="some error" let ans=_.isError(e) console.log(_.isError(e)) if(ans) console.log("It is the javascript error object") else console.log("It is not the javascript error object") </script> </body> </html> Output: Comment More infoAdvertise with us Next Article Underscore.js _.isError() Function T tarun007 Follow Improve Article Tags : JavaScript Web Technologies JavaScript - Underscore.js Similar Reads Underscore.js _.isArray() Function The Underscore.js is a JavaScript library that provides a lot of useful functions like the map, filter, invoke, etc even without using any built-in objects. The _.isArray() function is used to find whether the passed argument is an array or not. An array is a set of variables, constants, and special 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 _.isNumber() Function Underscore.js _.isNumber() function is used to check whether the given object parameter is a number or not. If the given object is a number then it returns True value otherwise, it returns False. Syntax:_.isNumber( object );Parameters:object: This parameter holds the object element that needs to be 1 min read Underscore.js _.isEmpty() Function Underscore.js _.isEmpty() function is used to check whether a list, array, string, object, etc is empty or not. It first finds out the length of the passed argument and then decides. If the length is zero, then the output is true otherwise false. Syntax:Â _.isEmpty(object);Parameters:It takes only on 3 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 Like