Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

copywithin javascript

// The copyWithin() method copies array elements to another position in the array.
// The copyWithin() method overwrites the existing values.
// The copyWithin() method does not add items to the array.
Syntax
array.copyWithin(target, start, end)

const fruits = ["Banana", "Orange", "Apple", "Mango", "Kiwi", "Papaya"];
console.log(fruits.copyWithin(2, 0, 2)); // Banana,Orange,Banana,Orange,Kiwi,Papaya
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #copywithin #javascript
ADD COMMENT
Topic
Name
8+4 =