Devtools Tech is a free platform for Frontend Engineers. It takes a lot of time, effort, and finanical resources to keep the platform running. If you see any value in our work and would like to support us then you can do using the following options.InternationalDomestic
In this question, the candidate needs to implement a function
customIncludes that mimics the behaviour of
includes() method determines whether an array includes a certain value among its entries, returning
false as appropriate.
const array = [5, 12, 8, 130, 44]; const found = array.customIncludes(5); // prints true console.print(found);
customIncludes takes two parameters
The value to search for.
The position in this array at which to begin searching for searchElement.
The first element to be searched is found at
fromIndex for positive values of
fromIndex, or at
arr.length + fromIndex for negative values of
Defaults to 0.
A boolean value which is true if the value searchElement is found within the array (or the part of the array indicated by the index fromIndex, if specified).
array.customIncludes(searchElement); array.customIncludes(searchElement, fromIndex);
Start the timer, complete your solution, and test it against the test cases provided by the platform. Ideally, you should finish this question within 30 mins. Share your solution with us -- https://twitter.com/devtoolstech