Skip to content

Instantly share code, notes, and snippets.

@Joejhorn
Created February 19, 2018 22:15
Show Gist options
  • Select an option

  • Save Joejhorn/1cc97a419e17ab86d56be3469dc2c0ac to your computer and use it in GitHub Desktop.

Select an option

Save Joejhorn/1cc97a419e17ab86d56be3469dc2c0ac to your computer and use it in GitHub Desktop.
Spread Operator Example - copy an array
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
(function() {
"use strict";
arr2 =[...arr1] ; // here you go.
console.log(arr2);
})();
console.log(arr2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment