Is it possible to create an empty multidimensional array in javascript/jquery?

后端 未结 8 2222
粉色の甜心
粉色の甜心 2020-12-06 10:36

I am trying to create a very basic Flickr gallery using the Flickr API. What I want to achieve is sorting my pictures by tag. What I am using is jQuery.getJSON() so that I c

8条回答
  •  臣服心动
    2020-12-06 11:32

    Yes, it's possible to have multidimensional arrays in javascript.

    Here are one-liners for 5x5 matrix:

    Array(5).fill(0).map(() => new Array(5).fill(0))

    Or

    [...Array(5)].map(x=>Array(5).fill(0))

提交回复
热议问题