运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Arrays</h1> <h2>findLastIndex()</h2> <p>findLastIndex() returns the index of the last element that passes a test (provided by a function).</p> <p id="demo"></p> <script> const ages = [3, 10, 18, 20]; document.getElementById("demo").innerHTML = ages.findLastIndex(checkAge); function checkAge(age) { return age > 18; } </script> <p>findLastIndex() is not supported in Internet Explorer.</p> </body> </html>