Last active
April 5, 2019 13:28
-
-
Save ZackFox/6eb3c3b0c0dbc5fed28b7549ad313f5e to your computer and use it in GitHub Desktop.
This file contains 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 characters
// ключевой принцип | |
// запись элементов в дополнительный массив | |
// проверка наличия элемента в массие | |
function removeDuplicates(nums){ | |
return nums.reduce((acc, n) => { | |
if(acc.indexOf(n) === -1) { | |
acc.push(n) | |
} | |
return acc; | |
}, []); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment