Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

copy an array with the spread operator

const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;

arr2 = [...arr1];

console.log(arr2); // ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #copy #array #spread #operator
ADD COMMENT
Topic
Name
2+1 =