运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Arrays</h1> <h2>The some() Method</h2> <p>The some() method checks if some array values pass a test:</p> <p id="demo"></p> <script> const numbers = [45, 4, 9, 16, 25]; let someOver18 = numbers.some(myFunction); document.getElementById("demo").innerHTML = "Some over 18 is " + someOver18; function myFunction(value, index, array) { return value > 18; } </script> </body> </html>