Array copyWithin in JavaScript
Level 263 keystrokes
copyWithin() copies part of an array to another location within the same array.
JavaScript code
// Create an array of numbers1const arr = [1, 2, 3, 4, 5];// copyWithin(0, 3) copies the elements from index 3 to the end (4, 5) to index 0 onward, in place// Result: [4, 5, 3, 4, 5]2console.log(arr.copyWithin(0, 3));Output
[ 4, 5, 3, 4, 5 ]
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
,× 5;× 2.× 2(× 2)× 2[× 1]× 1=× 1