Sort Array Without Inbuilt Functions In Javascript Are Objects