W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript Array.isArray()</h1> <p>单击按钮以检查“fruits”是否为数组。</p> <button onclick="myFunction()">试一试</button> <p id="demo"></p> <script> function myFunction() { var fruits = ["Banana", "Orange", "Apple", "Mango"]; var x = document.getElementById("demo"); x.innerHTML = Array.isArray(fruits); } </script> </body> </html>