Javascript Set entries()

Introduction

The Javascript Set entries() method returns an Iterator object for elements in the Set object.

It maintains the insertion order.

The returned value is in [value, value] format;

mySet.entries()

Using entries()

var mySet = new Set();
mySet.add('foobar');
mySet.add(1);/*  w ww  .  j  a va 2  s  .c o  m*/
mySet.add("one");
mySet.add('baz');

var setIter = mySet.entries();

console.log(setIter.next().value);
console.log(setIter.next().value);
console.log(setIter.next().value);



PreviousNext

Related