Question: I have two arrays and I would like to compare if these arrays have duplicated values, then return the values that aren't duplicates. Based on these two arrays I would like to return the string `Eucalipto`.

```js
const plants = [
  {
    id: 59,
    kind: "Cana-de-açucar"
  },
  {
    id: 60,
    kind: "Citros"
  }
];

const auxPlants = [
  "Cana-de-açucar",
  "Citros",
  "Eucalipto"
]
```

Answer: 
You can use `Array#map` to find all the `kind` values, pass that to the `Set` constructor, and then use `Array#filter` to find all elements of the array not in that `Set`.

```js
const plants = [
  {
    id: 59,
    kind: "Cana-de-açucar"
  },
  {
    id: 60,
    kind: "Citros"
  }
];
const auxPlants = [
  "Cana-de-açucar",
  "Citros",
  "Eucalipto"
];
const set = new Set(plants.map(({kind})=>kind));
const res = auxPlants.filter(x => !set.has(x));
console.log(res);
```
As said, please search for an already posted solution first. [Here's](https://stackoverflow.com/questions/14930516/compare-two-javascript-arrays-and-remove-duplicates) what I found.

Anyhow, the solution would be to separate the types of plants from the first array, as so:

```
const plantsTypes = plants.map(obj => obj.kind)

```

Then, filter out the non duplicates:

```
const nonDuplicates = auxPlants.filter(plant => !plantsTypes.includes(plant))

```

Note that it matters which array you call the .filter() function on.