Sort Array By Key Javascript Interview