![]() |
VOOZH | about |
The set.keys() method is the same as the values() method. This means it returns the new iterator object that contains the value of each set in the insertion order.
Syntax:
keys()Parameter: This method does not take any parameters.
Return Type: It returns the new iterator object which holds the values in the set.
Example 1: In this example, we will see the use of keys in the set.
Output:
[Set Iterator] { 'America', 'England', 'Chicago' }Example 2: In this example, we will see the keys() method which returns the set iterator.
[Set Iterator] { '0', 1 }
We have a complete list of Javascript Set methods, to check those please go through this Sets in JavaScript article.
Supported Browser: