Javascript Interview Coding Practice