Skip to content
This repository has been archived by the owner on Apr 1, 2021. It is now read-only.

Slasher Intermediate explanation has incorrect statement regarding slice() #1208

Open
raisedadead opened this issue Jul 2, 2016 · 1 comment

Comments

@raisedadead
Copy link
Member

Refers : freeCodeCamp/freeCodeCamp#9501

by @wiseleo:

Someone apparently copied the explanation from splice.

Modify the array with slice() and return it.

Slice does not modify arrays.

The slice() method returns a shallow copy of a portion of an array into a new array object. - Source: MDN

The entire explanation is problematic:

  • This solution uses the slice() function. OK
  • The argument howMany is the number of elements to be removed skipped since beginning of array starting with arr[0].
  • Modify the array with slice() and return it. Return the remaining array without modifying original array
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants