mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
davhojt
5d58cfb6d5
|
2 years ago | |
---|---|---|
.. | ||
README.md | 2 years ago |
README.md
Index Of
Instructions
Create 3 functions which accept an array to be searched, and a value to be matched.
indexOf
: which returns the index of the first occurrence. It also accepts an optional index from where the search should begin. If the value was not found,-1
is returned.lastIndexOf
: which works just like yourindexOf
function, but returns the index of the last occurrence.includes
: which returnstrue
if the value was found in the array, andfalse
otherwise.
Of course you must not use any of
Array.indexOf()
,Array.lastIndexOf()
orArray.includes()
.
Notions
Code provided
The provided code will be added to your solution, and does not need to be submitted.
Array.prototype.indexOf = undefined
Array.prototype.lastIndexOf = undefined
Array.prototype.includes = undefined