O GoConqr está de visual novo! Conte para nós o que você achou.

Notas

Sets in ES6

James Drummond Javascript A-Level Inglês 1 página

Conteúdo das notas (1)

Página 1

Every item in a set is guaranteed to be unique - an item will not be added to a set if it already exists.

So you don't have to iterate every element of an array to see if it exists.

var collection = new Set([1, 2, 3, 4, 5]);var newElements = [4, 8, 10];

for(var i = 0; i

collection.add(newElements[i]);

}

Useful methods and properties

Set.prototype.size - size of the set Set.prototype.constructor() - Takes array or other iterable as argument Set.prototype.add(value) - add an item to the set Set.prototype.delete(value) - delete an item from the set Set.prototype.has(value) - see if an item exists in the set Set.prototype.clear() - remove all elements from the set Set.prototype.forEach() - Iterate over the items of a set in insertion order Set.prototype.entries() - Obtain an iterator to loop through the set's elements Set.prototype.values() - returns an iterator object containing the values of the elements of the set

Informações

Descrição
A-Level Javascript (ES6) Notas sobre Sets in ES6, criado por James Drummond em 17-06-2015.
Criado por
James Drummond · jun 2015
Atualizado
26 mai 2016
Visualizações
9
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?