This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Lolman
over 10 years

Im not sure where to put this

What is wrong with my code why does it not return 2 1 3 5 //creates the class for all of the new digraphs function Sq(row,column){ this.column= column; this.row = row; } // declaring the digraph objects var fn = new Sq(3,1); var sn = new Sq(2,5); // to check if its in the same row if (fn.row===sn.row){ fn.column=(fn.column - 1)%6 ; sn.column=(sn.column - 1)%6 ; if(fn.column===0){ fn.column=5; } if(sn.column===0){ sn.column=5; } } //check if its in the same column else if(fn.column===sn.column){ fn.row=(fn.row - 1)%6 ; sn.row=(sn.row - 1)%6 ; if(fn.row===0){ fn.row=5; } if(sn.row===0){ sn.row=5; } } //check if (fn column is more than sn’s) else if(fn.column>sn.column){ fn.column = fn.column-(fn.column-sn.column); sn.column = sn.column+(fn.column-sn.column); } //check if (sn column is more than fn’s) console.log(fn.row); console.log(fn.column); console.log(sn.row); console.log(sn.column);