--- id: 9d7123c8c441eeafaeb5bdef title: Remove Elements from an Array Using slice Instead of splice challengeType: 1 videoUrl: '' localeTitle: '' --- ## Description undefined ## Instructions undefined ## Tests
```yml tests: - text: '' testString: 'assert(code.match(/\.slice/g), "Your code should use the slice method.");' - text: '' testString: 'assert(!code.match(/\.splice/g), "Your code should not use the splice method.");' - text: '' testString: 'assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]), "The inputCities array should not change.");' - text: '' testString: 'assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]), "nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]) should return ["Chicago", "Delhi", "Islamabad"].");' ```
## Challenge Seed
```js function nonMutatingSplice(cities) { // Add your code below this line return cities.splice(3); // Add your code above this line } var inputCities = ["Chicago", "Delhi", "Islamabad", "London", "Berlin"]; nonMutatingSplice(inputCities); ```
## Solution
```js // solution required ```