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 2020年1月.
flat() 函數以遞迴方式將特定深度的子陣列重新串接成為一新的陣列
指定巢狀陣列展開的深度。預設為 1。
函數將會回傳一個由原先陣列的子陣列串接而成的新陣列。
flat() 函數會自動清除陣列中空的元素
| ECMAScript® 2027 Language Specification # sec-array.prototype.flat |
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.