Skip to content

Instantly share code, notes, and snippets.

View Manubi's full-sized avatar
🏠
Working from home

Manuel Bichler Manubi

🏠
Working from home
View GitHub Profile
@lmfresneda
lmfresneda / remove_duplicates.js
Last active January 17, 2021 15:36
Remove duplicates from an array of objects in javascript
// FUN METHOD
/**
* Remove duplicates from an array of objects in javascript
* @param arr - Array of objects
* @param prop - Property of each object to compare
* @returns {Array}
*/
function removeDuplicates( arr, prop ) {
let obj = {};
return Object.keys(arr.reduce((prev, next) => {