Created
July 16, 2021 14:14
-
-
Save Volizik/8c64aaf59ff63640264a32b0163c1681 to your computer and use it in GitHub Desktop.
Revisions
-
Volizik created this gist
Jul 16, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function removeDouble(arr) { const resultArray = [] for (let i = 0, length = arr.length; i < length; i++) { const arrOfItems = arr.filter(item => item === arr[i]); if (arrOfItems.length === 1) { resultArray.push(arr[i]) } } return resultArray } console.log(removeDouble([1, 2, 1, 3, 3, 4, 5, 6, 4, 8, 6]))