# Learn Functional Programming by Building a Spreadsheet - Step 102

### Tell us what’s happening:

I found a method which help me to remove all duplicates elements but they still telling me that it’s not good. But they say that we’re free to use any method. Can someone help to find another look for this problem

``````<!-- file: index.html -->

``````
``````/* file: styles.css */

``````
``````/* file: script.js */
// User Editable Region

sum,
average,
median,
even: nums => nums.filter(isEven),
someeven: nums => nums.some(isEven),
everyeven: nums => nums.every(isEven),
firsttwo: nums => nums.slice(0, 2),
lasttwo: nums => nums.slice(-2),
has2: nums => nums.includes(2),
increment: nums => nums.map(num => num + 1),
random: ([x, y]) => Math.floor(Math.random() * y + x),
range: nums => range(...nums),
nodupes: nums => {
for(let i = 0; i < nums.length; i++){
const firstIndex = nums.indexOf(nums[i], 0)
let lastIndex = nums.lastIndexOf(nums[i], -1)
if(lastIndex > firstIndex){
nums.splice(lastIndex, 1)
deleteDoubleValue(nums)
}
}
return nums
}
}

// User Editable Region
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36`

### Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 102

Where is this function defined, I don’t see it in the code snippet.

Thanks man, I forgot it
It finally worked

1 Like

Hello @yannmbiami.
You don’t need to create new function as name `deleteDoubleValue` also your `nodupes` code block already too long. Here is the helpfull article for handling to dublicated elements. One of them very usefull and teached by previous lesson. You should look and remember it.
Good luck!

1 Like