Array.prototype.indexOfbeginnerconst arr = [10, 20, 30, 40]
arr.indexOf(30) // β 2
arr.indexOf(20) // β 1Use indexOf() to find the position of the first occurrence of a value in an array.
Array.prototype.indexOf(value, fromIndex?) returns the index of the first occurrence of value using strict equality (===), or -1 if not found.
Challenge: Implement firstIndexOf(arr, val) that returns arr.indexOf(val).
firstIndexOf([1, 2, 3, 2], 2) // β 1
firstIndexOf([1, 2, 3], 9) // β -1