Check if a Rook can reach the given destination in a single move | Function to check if it is possible to reach destination in a single move by a rook ; Given arrays
function check ( current_row , current_col , destination_row , destination_col ) { if ( current_row == destination_row ) return " " ; else if ( current_col == destination_col ) return " " ; else return " " ; } let current_row = 8 ; let current_col = 8 ; let destination_row = 8 ; let destination_col = 4 ; let output = check ( current_row , current_col , destination_row , destination_col ) ; document . write ( output ) ;