JavaScript sorted dictionary