Typescript Array Shift Javascript Interview Question