VOOZH about

URL: https://www.geeksforgeeks.org/javascript/underscore-js-_-ismap-function/

⇱ Underscore.js _.isMap() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Underscore.js _.isMap() Function

Last Updated : 25 Nov, 2021

Underscore.js is a library in javascript that makes operations on arrays, string, objects much easier and handy. _.isMap() function is used to check whether the given object is javascript Map 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:

_.isMap(object);

Parameters : 

  • object : It is any javascript object such as array, string, maps, set etc.

Returns : It returns the boolean value. If the object is a Map 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 an array is given the output is false.

Output:

👁 Image

Example 2:

When a Map is given it returns true.

Output:

👁 Image

Example 3:

When giving an object as a parameter the output is false

Output:

👁 Image
Comment