How to write JavaScript indexOf and lastIndexOf array methods from scratch
indexOf
Returns first index of the found element otherwise -1.
Array.prototype._indexOf = function(searchElement, fromIndex = 0) {
for(let i = fromIndex; i < this.length; i++) {
if(searchElement === this[i]) {
return i
...
blog.devbitbyte.com1 min read