Last active
June 19, 2020 17:19
-
-
Save geomago/b020b1dfecd0e85e7511adfdd9a6a700 to your computer and use it in GitHub Desktop.
remove_dupl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let carsAsString = cars.map( (item) => JSON.stringify(item)); | |
let unique = [...new Set(carsAsString)].map( (item) => JSON.parse(item) ); | |
// RESULT IS: | |
[ | |
{id:1,make:"Ferrari",model:"812GTS",price:336000,colour:"rosso corsa"}, | |
{id:2,make:"Ferrari",model:"F8 Spider",price:262000,colour:"giallo modena"}, | |
{id:3,make:"Lamborghini",model:"Aventador S",price:329400,colour:"blu le mans"}, | |
{id:4,make:"Bugatti",model:"Chiron Pur Sport",price:3000000,colour:"blue"}, | |
{id:5,make:"McLaren",model:"New GT",price:203000,colour:"helios orange"}, | |
{id:6,make:"Ferrari",model:"F8 Spider",price:262000,colour:"giallo modena"}, | |
{id:7,make:"Ferrari",model:"F8 Spider",price:262000,colour:"red"}, | |
{id:8,make:"Bugatti",model:"Chiron Pur Sport",price:3000000,colour:"red"} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment