Skip to content

Instantly share code, notes, and snippets.

View jghorton14's full-sized avatar
🎯
Focusing

Jarrett Horton jghorton14

🎯
Focusing
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) => {