The horizontal comparison method uses the reduce method of the Js standard library to return the result of each comparison as the first parameter passed to the function for the next comparison, and the second parameter is the current string. Note that the reduce method computes n-1 times for an array of length n when there is no third parameter. The vertical comparison means comparing each character in the string array one by one, constantly looping through each character of the string in the array. During the comparison, the loop ends and returns the result when a different character is encountered in the column.