これはオブジェクト指向のJavaScriptで私の最初の試みである:オブジェクト指向のJavascript
function GuiObject() {
this.x = 0;
this.y = 0;
this.width = 0;
this.height = 0;
this.parent = null;
this.children = [];
this.getWidth = function()
{
return this.width;
};
this.getHeight = function()
{
return this.height;
};
this.paint = function(ctx)
{
};
};
function paintGui(ctx, root)
{
ctx.save();
ctx.translate(root.x, root.y);
root.paint(ctx);
for (int i=0; i<root.children.length; ++i)
{
paintGui(ctx, root.children[i]);
}
ctx.restore();
};
今paintGUI機能で、ラインroot.children.lengthsでエラーが発生します:
キャッチされないでSyntaxError:予期しない識別子を。
どうしたのですか?
ありがとうございます!
彼らがどんなエラーを投げるか – deceze
うん、* "エラー" *あなたは言う?おそらくあなたは何か間違っていたのでしょうか? :) –
ええ、私は同意します。それは間違いなく間違っていることです。 –