CodesJava

Easy learning with example program codes

JavaScript Map values() method

The JavaScript map values() method is used to retrieve an object of Map iterator that contains the values for each element.

Syntax:

mapObj.values()

Return:
An object of Map iterator.

Example:

<!DOCTYPE html>
<html>
<body>
<script>  
var map=new Map();  
map.set('a',"GOOD MORNING");
map.set('b',"GOOD AFTERNOON");
map.set('c',"GOOD EVENING");  
map.set('d',"GOOD NIGHT");  
var itr= map.keys();  
for(i=0;i<map.size;i++){
   document.writeln(itr.next().value+"<br>"); 
}
</script>  
</body>
</html>

Output:

a
b
c
d
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status