小编Bes*_*o56的帖子

我的循环将循环,但它不会显示我想要的

我有我的数组,我想基于数组中每个对象内的whats显示数组.我在这里有循环,但我似乎可以开始ctx.fillRect工作.

var c = document.getElementById("can");
var ctx = c.getContext("2d");
var blocks = [];

var rows = [0, 1, 2, 3];

function Block(h, w, x, y, c) {
  this.h = h;
  this.w = w;
  this.x = x;
  this.y = y;
  this.c = c;
}
ctx.fillRect(900, 400, 10, 10)
for (var i = 0, len = rows.length; i < len; i++) {
  for (var j = 0; j < 10; j++)
    blocks.push(new Block(10, 20, j * 30, i * 30, …
Run Code Online (Sandbox Code Playgroud)

javascript arrays loops

2
推荐指数
1
解决办法
81
查看次数

标签 统计

arrays ×1

javascript ×1

loops ×1