Get to know MDN better
此頁面由社群從英文翻譯而來。了解更多並加入 MDN Web Docs 社群。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
Array.isArray() 函式會檢查傳入的值是否為一個 Array。
要檢查的物件。
若物件為 Array 回傳 true;否則回傳 false。
檢查傳入的物件是否為陣列(Array),如果是便回傳 true,否則回傳 false。
更多細節請參考 「Determining with absolute accuracy whether or not a JavaScript object is an array」。
當檢查 Array 實例時,Array.isArray 相較於 instanceof 更加推薦,因為它可以穿透 iframes。
如果 Array.isArray() 不存在於你的環境,在其他程式碼前執行下列程式碼可建置 Array.isArray()。
| ECMAScript® 2027 Language Specification # sec-array.isarray |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年7月14日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.