This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.
Smartphone icons created by Freepik - Flaticon
const numbers = [4, 9, 16, 25, 29]; document.getElementById("demo").innerHTML = "First number over 18 has index " + numbers.findIndex(myFunction); function myFunction(value, index, array) { return value > 18; }
Note that the function takes 3 arguments: