Shift & unshift

how is this shift and unshift working here?


you can read their working here