function createMultiDimArray() { let results = []; let current = []; for (let i = 1; i <= 10; i++) { current.push(i); if (i % 2 === 0) { results.push(current); current = []; } } return results; } let arr = createMultiDimArray();输出结果:
[[1,2],[3,4],[5,6],[7,8],[9,10]]