Array Sort By Javascript Interview Question