Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
Delete dublicate value from Row in JS

How to delete the dublicate value from Row? my array look like this

let array =[["a"],["b"],["c"],["a"],["b"],["c"]];

almost 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

const array =[["a"],["b"],["c"],["a"],["b"],["c"]]; 

const resultSet = new Set();
const resultArr = [];

array.forEach(items => {
  items.forEach(item => {
      resultSet.add(item);
  });
});

for(const item of resultSet) {
    resultArr.push([item]);
}

console.log(resultArr);

almost 4 years ago · Santiago Trujillo Denunciar

0

There's this... use new Set and spread after breaking apart the array, then stitch it back together

[...new Set(array.join(''))].map(m=>[m])

const array =[["a"],["b"],["c"],["a"],["b"],["c"]]; 
let filtered = [...new Set(array.join(''))].map(m=>[m])
console.log(filtered)

almost 4 years ago · Santiago Trujillo Denunciar

0

You should group by a property. For example, the first item in the array.

let array =[["a"],["b"],["c"],["a"],["b"],["c"]]; 

var result = Object.values(array.reduce(function(agg, item) {
  var key = item[0]
  agg[key] = agg[key] || item
  return agg
}, {}))

console.log(result)

almost 4 years ago · Santiago Trujillo 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda