var items = ['eggs', 'milk', 'cheese', 'bread', 'butter']; items.shift() gs.print(items); // [ 'milk', 'cheese', 'bread', 'butter' ]
Output:
shift() is a convenience method of sorts and is used to remove the first element of an array.
Working Code Asked question July 20, 2023