Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Eliminar el valor duplicado de la fila en JS

¿Cómo eliminar el valor duplicado de la fila? mi matriz se ve así

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

almost 4 years ago · Santiago Trujillo
3 answers
Answer question

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 Report

0

Está esto... usa el new Set y spread después de separar la matriz, luego vuelve a unirla.

 [...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 Report

0

Debe agrupar por una propiedad. Por ejemplo, el primer elemento de la matriz.

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

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

console.log(result)

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!