Skip to content

Instantly share code, notes, and snippets.

@ZackFox
Last active April 5, 2019 13:28
Show Gist options
  • Save ZackFox/6eb3c3b0c0dbc5fed28b7549ad313f5e to your computer and use it in GitHub Desktop.
Save ZackFox/6eb3c3b0c0dbc5fed28b7549ad313f5e to your computer and use it in GitHub Desktop.
// ключевой принцип
// запись элементов в дополнительный массив
// проверка наличия элемента в массие
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