“matriz para establecer JavaScript” Código de respuesta

matriz para establecer JavaScript

const myArray = [1,2,3,1,5,8,1,2,9,4];
const unique = [...new Set(myArray)]; // [1, 2, 3, 5, 8, 9, 4]

const myString = ["a","b","c","a","d","b"];
const uniqueString = [...new Set(myString)]; //["a", "b", "c", "d"]
Batman

establecer js

// Use to remove duplicate elements from the array 

const numbers = [2,3,4,4,2,3,3,4,4,5,5,6,6,7,5,32,3,4,5]

//spreading numbers of the object into an array using the new operator
console.log([...new Set(numbers)]) 

// [2, 3, 4, 5, 6, 7, 32]
Happy Hyena

JS New Array del nuevo set

return Array.from(new Set(this.posts.map(e => e.category)))
Diz Andriana

Respuestas similares a “matriz para establecer JavaScript”

Preguntas similares a “matriz para establecer JavaScript”

Más respuestas relacionadas con “matriz para establecer JavaScript” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código