第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

旋轉(zhuǎn)方法參數(shù)不匹配報錯??!

square.js:70 Uncaught TypeError: Cannot read property '0' of undefined

? ? at Square3.Square.rotate (square.js:70)

? ? at Game.rotate (game.js:89)

? ? at HTMLDocument.document.onkeydown (local.js:23)

試理解執(zhí)行順序:

刷新頁面:init()【game.js】>>cur = SquareFactory.prototype.make(2,2,)【game.js】>>s.rotate(2)【squareFactory.js】>>rotate(num)【square.js】;

按上箭頭鍵 : Game.rotate()【local.js】>>cur.rotate()【game.js】>>rotate(num)【square.js】;

疑惑:最后執(zhí)行旋轉(zhuǎn)到底有沒有參數(shù),假如有參數(shù)是哪一步賦值的?

樓下為我寫的代碼:


正在回答

1 回答

Square.prototype.canRotate?=?function?(isValid)?{
????var?tsPoints?=?this.orgPoints;
????var?tsCodes;
????var?tsDrt?=?(this.drt?+?1)?%?4;

????tsCodes?=?[
????????[0,?0,?0,?0],
????????[0,?0,?0,?0],
????????[0,?0,?0,?0],
????????[0,?0,?0,?0]
????];

????for?(var?i?=?0;?i?<?this.squCodes.length;?i++)?{
????????for?(var?j?=?0;?j?<?this.squCodes[0].length;?j++)?{
????????????tsCodes[i][j]?=?this.rotCodes[tsDrt][i][j];
????????}
????}
????return?isValid(tsPoints,?tsCodes);
};
Square.prototype.rotate?=?function?(num)?{
????if?(!num)?{
????????mum?=?1;
????}
????this.drt?=?(this.drt?+?num)?%?4;
????for?(var?i?=?0;?i?<?this.squCodes.length;?i++)?{
????????for?(var?j?=?0;?j?<?this.squCodes[0].length;?j++)?{
????????????this.squCodes[i][j]?=?this.rotCodes[this.drt][i][j];
????????}
????}
};


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

旋轉(zhuǎn)方法參數(shù)不匹配報錯??!

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號