There are several issues here. First your loop condition is i==n, the loop will be executed while this condition is true, since from the start it is never true it will also never execute and move straight to the “return true” after the loop. Second, you have a lot of return statements in your for loop, that will end the function immediately when the return is hit. Have you really done all the work by the time you hit any of those returns?
Other than that a lot of your if statements also do not make very much sense to me, such as if (n == i) this is your loop condition, at this point you’ve done nothing which would change that condition and you will not be in the loop unless it’s true. Then you nest an if (arr[i] === arr[n] given that you only get to this point if n == i how could the same index in the same array hold a value that’s different?
I’ve pointed out some oddities in your code, you need to fix those issues and work more on the logic. If you need more help feel free to ask.
This part is on the right track though: