Knowledgize

.copyWithin(target, start, end)

Shallow copies part of an array to another location in the same array and returns it without modifying its length.

Examples:

let numbers = [1, 2, 3, 4, 5]; numbers.copyWithin(0, 3); console.log(numbers); // [4, 5, 3, 4, 5]
let letters = ['a', 'b', 'c', 'd', 'e']; letters.copyWithin(1, 3, 4); console.log(letters); // ['a', 'd', 'c', 'd', 'e']