Skip to content

matheusrufinos/shift-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

JavaScript Shift Method

The goal is to replicate JavaScript's shift() functionality

How will it work?

  1. The shift() method must receive a list
  2. The value of the first index in the list must be removed
  3. The method must return the extracted value

Example

function shift(list) {
    // code
}

let myList = ['dog'. 'banana', 'orange']
const shiftList = shift(myList)

console.log(shiftList)
// return 'dog'

console.log(myList)
// return ['banana', 'orange']

Testing

Create a test to validate the behavior is as expected, you can even start by testing to train TDD.

Contribute

Place the challenge files inside the challenge/your-github-username folder and open a pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published