This should work as the original values are numbers, but this is inefficient as the numeric values have to be stringified to be put as keys the hash. And the hash construction itself counts too.
That only matters if you are working with literally millions of items, and the alternative is far worse. Constructing a hash is more efficient than, say, sorting a large list of items.