Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Filter unique

node v10.24.1
version: master
endpointsharetweet
const x = [1,2,3,4,1,3,5,8,9,9]; const unique = (elem, index, array) => { for (var i = 0; i < index; i++) { if (array[i] === elem) return false; } return true; }; const result = x.filter(unique); console.log(result);
Loading…

no comments

    sign in to comment