The function takes a section of the array and copies it to another place within the array.
target: index where to copy the elements
start: beginning of section to copy
end: end of section to copy. Optional, if not specified the section will go to the end of the array
Here is a visual representation of what happens:
- As expected parameters are 0 based indexes.
copyWithinmodifies the array itself, it does not return a copy of it.
- The array size if not modified,
copyWithinonly copies what fits.