如何在javascript中轻松创建空矩阵?
- 论坛
- 如何在javascript中轻松创建空矩阵?
12 浏览
如何在javascript中轻松创建空矩阵?
在Python中,您可以这样做:
[([None] * 9) for x in range(9)]
然后您会得到:
[[None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None]]
我如何在JavaScript中实现相同的效果?