en.javascript.info/1-js/4-data-structures/6-array/7-array-find/task.md
Ilya Kantor 87bf53d076 update
2014-11-16 01:40:20 +03:00

18 lines
434 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]
Создайте функцию `find(arr, value)`, которая ищет в массиве `arr` значение `value` и возвращает его номер, если найдено, или `-1`, если не найдено.
Например:
```js
arr = [ "test", 2, 1.5, false ];
find(arr, "test"); // 0
find(arr, 2); // 1
find(arr, 1.5); // 2
find(arr, 0); // -1
```