Array.pop

In this coding challenge, you will be implementing a function called remove(array) that takes one argument: an array. The function should remove the last element from the input array and return the array.

Instructions

  • If the input array is empty, return an empty array.

Example test cases

remove([1, 2, 3]); // Output: [1, 2] remove(['foo', 'bar', 'baz']); // Output: ['foo', 'bar']

Hints

  • You can use the built-in method .pop() directly on the input array.
Adding your container request
Getting your dedicated container
Connecting to your container
Setting up your editor
Finalizing your playground
TerminalEditorBrowser