You first need to insert the item to the end of the array arr using the method push() on the array arr.
And then remove and return the first element of the array using shift() method on the array arr.
- push(): Add items to then end of an array. push() returns the new array length.
- shift(): Remove an item from the beginning of an array. shift() returns the removed item.
- pop(): Remove an item from the end of an array. pop() returns the removed item.
- unshift(): Add items to the beginning of an array. unshift() returns the new array length.