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.
1.1 KiB
1.1 KiB
Index Of
Instructions
Create 3 functions:
indexOf
that returns the index of the first occurence of a valuelastIndexOf
that returns the index of the last occurence of a valueincludes
that returns true if the value was found in the array
If a value is not found, the returned index is -1
functions should have an array element as first argument, both
indexOf
andlastIndexOf
take an additionalfromIndex
argument that allows you to begin searching from a specific index.
Notions
- devdocs.io/javascript/global_objects/array/indexof
- devdocs.io/javascript/global_objects/array/lastindexof
- devdocs.io/javascript/global_objects/array/includes
Code provided
all code provided will be added to your solution and doesn't need to be submited.
Array.prototype.indexOf = undefined
Array.prototype.lastIndexOf = undefined
Array.prototype.includes = undefined