112k views
1 vote
The slice() method reverses the order of items in an array, making the last items first and the first items last.

A) True
B) False

User Jbaldwin
by
7.1k points

1 Answer

1 vote

Final answer:

The slice() method does not reverse the order of an array's items; that is the functionality of the reverse() method. Slice() is used to create a shallow copy of a part of an array.

Step-by-step explanation:

The correct answer is B) False. The slice() method does not reverse the order of items in an array. Instead, it returns a shallow copy of a portion of an array into a new array object selected from start to end (end not included). The order of the items in the new array remains the same as the original. The statement that the slice() method reverses the order of items in an array is False. The slice() method in JavaScript is actually used to return a shallow copy of a portion of an array into a new array object. If you are looking to reverse the order of an array, you should use the reverse() method. The slice() method takes two arguments: the start index and an optional end index, and it extracts elements from the start index up to, but not including, the end index.

User Allicarn
by
7.6k points