one for loop wraps 2 indexof method, what is the time efficiency?
Yes, you are correct. But time complexity we measure only in big-O notation.

So the code above has time complexity $\mathcal O(n^2)$

The space complexity depends on indexof's space complexity. Assuming it was done with a for loop and a simple comparison, the space complexity would be $\mathcal O(log(n))$ - as the  storing the array length $n$ required $log(n)$ bits, and therefore keeping in memory the index i will take at most that much space.