en.javascript.info/1-js/4-data-structures/8-array-methods/11-array-unique/task.md
2015-03-10 12:36:58 +03:00

22 lines
588 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Оставить уникальные элементы массива
[importance 3]
Пусть `arr` -- массив строк.
Напишите функцию `unique(arr)`, которая возвращает массив, содержащий только уникальные элементы `arr`.
Например:
```js
function unique(arr) {
/* ваш код */
}
var strings = ["кришна", "кришна", "харе", "харе",
"харе", "харе", "кришна", "кришна", "8-()"
];
alert( unique(strings) ); // кришна, харе, 8-()
```