We will define a function and later create an instance of that new function. Javascript: How can I get the name of a function? Does it make physical sense to assign an entropy to a microstate? document.write(mapobj.get(0) +"
" ); Throws: IndexOutOfBoundsException - If the index is out of range i.e. Below examples illustrate the get() function in collect.js:Example 1: Here in this example, we take a collection and then using the get() function, it returns the value using the key. The values in the map are then retrieved using the get() method.