jquery - multidimensional array declaration issue javascript -


I have two multidimensional arrays $ path and $ record, I have to loop down and update array values, which have some problem Array announcements, I'm not able to know.

console error : Unkit type error: line 'code' can not be defined on '0' if line ($ record [$ path [A] [line] ICL]] [J]] {$ $ record [i] [2] = true; / Code> is with the same $ path, but before line error, values ​​are recovered from the array not specified just 5 lines, that is, $ path = [[start $]]; Therefore, the error occurs when both arrays are used jointly if ($ record [$ path [a] [icell]] [j]) {.

If you need jsfiddle, do not serve this purpose, which includes many other irrelevant scripts, so unnecessarily making the code heavier, I hope that I made myself as clear as possible I would definitely need any kind of clarity.

JQUERY:

  var $ record = new array; $ ("Hull Button"). On ("click", function () {if (($ start + 1) & amp; ($ end + 1)) {var i = 0, x, y; $ ("Td"). Function () (if! ($! IsArray ($ record [i]) {$ record [i] = [];} if (! $ (This) .hasClass ("top")) {If ($ (this ) .css ("border-top-color") == "RGB (0, 0, 0)") {$ record [i] [0] = true;}} and {$ record [I] [0] = False;} if ($! ($!) ($!) ($ (This) .hasClass ("right") {if ($ (this). CSS ("border-right-color") == "RGB (0, 0, 0)") $ Record [i] [1] = true;}} and {$ record [i] [1] = false;} if (! $ (This) .hasClass ("down")) {if ($ (this). CSS ("border-down-color") == "RGB (0, 0, 0)") {$ record [i] [2] = true;}} and {$ record [i] [2] = false; } If (! $ (This) .hasClass ("left") {if ($ (this) .css ("border-left-color") == "RGB (0, 0, 0)") {$ record [i] [3 ] = True;}} and {$ record [i] [3] = false;} I ++;}); //console.log ("record [2] [0]:" + $ record [2] [ 0]);} and {$ ("" both "). Fidine (" sharp ", function () {$ (" # both "). Delay (2000). FadeOut ();});} / * find the path * / Var $ path = new array (), // $ path [path_indix] [cell_indix] ipath = 0, icell = 0, fresh = old = 0; $ Path = {}; If (! $ .aIRRA ($ path [0])) {$ path [0] = []; } $ Path = [[begin $]]; (I = 0; i & lt; $ ("# maze td"). Length; i ++) {for (j = 0; j & lt; 4; j ++) {for (a = 0; a & Lt; = ipath; a ++) {icell = $ path [A] [$ path [A]. Length-1]; If (icell + 1) {if ($ record [$ path [a] [icell]] [j]) {old = fresh; If ($! IARRA ($ path [A])) {$ path [A] = []; } If (j = 0) {for (k = 0; k & lt; = icell; k ++) {$ path [a] [k] = $ path [a-1] [k]; } $ Path [A] [icl + 1] = $ path [a] [icl] - $ column; // Moving Top iPad ++; } And if (j = 1) {for (k = 0; k; l; = icell; k ++) {$ path [a] [k] = $ path [a -1] [k]; } $ Path [a] [icl + 1] = $ path [a] [icl] + 1; // right ipath ++ runs; } And if (j = 2) {for (= 0; k; l = = icell; k ++) {$ path [a] [k] = $ path [a -1] [k]; } $ Path [A] [icl + 1] = $ path [a] [icl] - $ column; // moving down ipath ++; } Else {for (k = 0; k & lt; = icell; k ++) {$ path [a] [k] = $ path [a-1] [k]; } $ Path [a] [icl + 1] = $ path [a] [icl] - 1; // left ipath ++; }}}}}}});  


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -