Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Copy Array Using Spread Operator

const arr1 = ['one', 'two'];
const arr2 = [...arr1, 'three', 'four', 'five'];

console.log(arr2); 
//  Output:
//  ["one", "two", "three", "four", "five"]
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #Copy #Array #Using #Spread #Operator
ADD COMMENT
Topic
Name
1+4 =