• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

156
Vistas
find and create a new array just with one sort of value and eliminate duplicates (if many)

I'm trying to find a method for sorting an array by uuid and eliminate the duplicate.

For exemple i have a array like this :

const x = [
{id: 1, uuid: xxxx-xxxx-xxxx-xxxx, content: 'string'},
{id: 2, uuid: xxxx-xxxx-xxxx-xxxx, content: 'string'},
{id: 3, uuid: xxxx-xxxx-xxxx-xxxx, content: 'string'},
{id: 4, uuid: xxxx-xxxx-xxxx-xxxx, content: 'string'},
{id: 5, uuid: xxxx-xxxx-xxxx-xxxx, content: 'string'},
{id: 6, uuid: xxxx-xxxx-xxxx-xxxx, content: 'string'},
{id: 7, uuid: yyyy-yyyy-yyyy-yyyy, content: 'string'},
{id: 8, uuid: zzzz-zzzz-zzzz-zzzz, content: 'string'}
]

And i'm trying to find a simple way for making this in result :

const x = [xxxx-xxxx-xxxx-xxxx, yyyy-yyyy-yyyy-yyyy, zzzz-zzzz-zzzz-zzzz]

I know it's maybe basic but my brain is off i guest ...

Thanks !

about 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this, but i used a string type for uuid:

[...new Set(x.map(e => e.uuid))].sort()
about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda