旋轉方法參數不匹配報錯??!
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)
試理解執行順序:
刷新頁面: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】;
疑惑:最后執行旋轉到底有沒有參數,假如有參數是哪一步賦值的?
樓下為我寫的代碼:
2019-03-29