The goal is to replicate JavaScript's shift() functionality
- The shift() method must receive a list
- The value of the first index in the list must be removed
- The method must return the extracted value
function shift(list) {
// code
}
let myList = ['dog'. 'banana', 'orange']
const shiftList = shift(myList)
console.log(shiftList)
// return 'dog'
console.log(myList)
// return ['banana', 'orange']
Create a test to validate the behavior is as expected, you can even start by testing to train TDD.
Place the challenge files inside the challenge/your-github-username folder and open a pull request.