Remove-Redundant-Slice-Index
Documentation Index
Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sourcery rule id: remove-redundant-slice-index
Section titled “Sourcery rule id: remove-redundant-slice-index”Description
Section titled “Description”Remove a redundant index from the array .slice() method.
Before
Section titled “Before”const toEnd = numbers.slice(3, numbers.length)const toEnd = numbers.slice(3)Explanation
Section titled “Explanation”Parameters in the array prototype .slice(start, end) method are optional, and by convention you should only use
the necessary ones, to simplify readability. The end is not necessary if you want to slice to the end of the
array. The start is additionally not necessary if you want to slice from the start of the array.