Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将数组转换为数组数组。
例如,如果我的数组是:
a = [1,2,3,4,5,6]
我想:
b = [[1,2],[3,4],[5,6]]
我怎样才能做到这一点?
function Create2DArray(rows) { var arr = []; for (var i=0;i<rows;i++) { arr[i] = []; } return arr; }