Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
karthikeya Boyini

The entries() function of the Set returns an iterator object which holds the contents of the current Set. This iterator object returns a pair of values for each entry just like map (key and value). But here, instead of both key and value it returns the element of the set in the particular position.

Syntax

Its Syntax is as follows

setObj.entries()

Example

Live Demo

<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script type="text/javascript">
         const setObj = new Set();
         setObj.add('Java');
         setObj.add('JavaFX');
         setObj.add('JavaScript');
         setObj.add('HBase');
         const entries = setObj.entries();
         document.write("<br>");
         for (let item of entries) {
            document.write(item);     
            document.write("<br>");           
         }             
      </script>
   </body>
</html>

Output

Contents of the Set after deletion:
Java,Java
JavaFX,JavaFX
JavaScript,JavaScript
HBase,HBase

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.