DEV Community

Discussion on: 8 neat Javascript tricks you didn't know in 4 minutes.

blessinghirwa profile image
Blessing Hirwa Author • Edited on

Try this: => {
let unique_values = [ Set(element.fruits )]
// console.log(element.fruits)
return unique_values;

or simply do it like this:

console.log( =>
unique_values = [ Set(element.fruits )]

You can either console them or store them in a variable. Overwriting the old values is also possible.

Some comments have been hidden by the post's author - find out more