pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Set/values

tps://developer.mozilla.org/favicon.ico" />

Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.

View in English Always switch to English

Set.prototype.values()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since julho de 2015.

O método values() retorna um novo objeto Iterator que contem os valores para cada elemento dentro do objeto Set por ordem de inserção.

O método keys() é um alias desse método (por similaridade com os objetos Map); ele se comporta exatamente da mesma forma e retorna os valores dos elementos do Set.

Experimente

const set1 = new Set();
set1.add(42);
set1.add("forty two");

const iterator1 = set1.values();

console.log(iterator1.next().value);
// Expected output: 42

console.log(iterator1.next().value);
// Expected output: "forty two"

Sintaxe

mySet.values();

Valor retornado

Um novo objeto Iterator condendo os valores de cada elemento contido no Set, por ordem de inserção.

Exemplos

Usando values()

js
var mySet = new Set();
mySet.add("foo");
mySet.add("bar");
mySet.add("baz");

var setIter = mySet.values();

console.log(setIter.next().value); // "foo"
console.log(setIter.next().value); // "bar"
console.log(setIter.next().value); // "baz"

Especificações

Specification
ECMAScript® 2026 Language Specification
# sec-set.prototype.values

Browsers compatíveis

Veja também

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy