You are making this problem more difficult than it has to be. You are declaring many unneeded arrays and variables in general. You only uploaded a screenshot from line 1 to 39, so I do not know what other code you have. It is better to copy and paste the code directly into the forum and then use three backticks (left of #1 on the keyboard) before and after to have it show up as you original typed it. Here are a few suggestions to clean up your code while leaving a few of your variable names:
1st, instead of declaring an empty arrays fst (line 4), snd (line 7), delete those lines replace your line 14 and 15 with the following:
var fst = arr.toLowerCase();
var snd = arr.toLowerCase();
All you want is the first element in the array (index 0) for fst and the second element in the array (index 1) for snd
2nd, you should remove all variable declarations which are not used in your code such as lines 8, 9, 10, 11, 12, 13, 16, and 17. It just clutters up all of your code.
Not sure why you are pushing items on to the array called emptyf . In general, it is hard to comment much more, because I can not see past line 39, but your logic in your if statements and return statements is not correct.
Please post entire cleaned up code and I will try to help you some more.