Your implementation is elegant, clean, easy to read.
The other is less so, but there is a significant difference between the two: your version returns a new array of unique values, the other removes duplicate values, modifying the input array.
Both algorithms are \$O(n^2)\$. Your implementation includes one redundant comparison per element: when the
indexOf call reaches the current element, it compares it to itself, which is a redundant comparison for your ultimate intent of finding unique values. The other implementation optimized this with the
var j = i + 1; step: it compares the current element to all subsequent element, never to itself.
In the end, the performance difference will come down to the implementation of
For what it's worth, in cases when an \$O(n^2)\$ solution to this problem is good enough (as opposed to an \$O(n)\$ solution using \$O(n)\$ extra space), I would go for your version, because it's intuitively easier to read.