Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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"]];

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading