Use the copyWithin() method in JavaScript to copy array elements. You can set the index from where (index) the element is copied. The following are the elements supported by JavaScript.
You can try running the following code to learn how to use the copyWithin() method in JavaScript.
<!DOCTYPE html> <html> <body> <script> var num = ["One", "Two", "Three", "Four", "Five", "Six", "Seven"]; document.write(num); document.write("<br>"+num.copyWithin(3,0,4)); </script> </body> </html>
The above is the detailed content of What is the usage of copyWithin() method in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!