W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>如果指定对象属于指定对象的实例,则 instanceof 运算符返回 true。</p> <p id="demo"></p> <script> var cars = ["Audi", "Volvo", "BMW"]; document.getElementById("demo").innerHTML = (cars instanceof Array) + "<br>" + (cars instanceof Object) + "<br>" + (cars instanceof String) + "<br>" + (cars instanceof Number); </script> </body> </html>