Array.prototype.indexOfbeginnerconst arr = [1, 2, 3]
arr.indexOf(99) // β -1 (not found)indexOf() returns -1 when the value is not present β always check for this sentinel.
By convention, -1 means "not found" for all index-returning array methods. Always check the return value before using it as an index.
Challenge: Implement indexOf5(arr) that returns the index of 5 in the array, or -1 if not present.
indexOf5([1, 5, 3]) // β 1
indexOf5([1, 2, 3]) // β -1