This forum is now read-only. Please use our new forums! Go to forums
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);
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency