let studentNames = ["Daniel", "Jane", "Joe"];
let names = [...studentNames];
console.log(names); // ["Daniel","Jane","Joe"]
// This saves us the time we would use to write a loop statement:
let arr1 = [ 1, 2, 3];
let arr2 = arr1;
console.log(arr1); // [1, 2, 3]
console.log(arr2); // [1, 2, 3]
// append an item to the array
arr1.push(4);
console.log(arr1); // [1, 2, 3, 4]
console.log(arr2); // [1, 2, 3, 4]
const arr1 = ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
let arr2;
arr2 = [...arr1];
console.log(arr2); // ['JAN', 'FEB', 'MAR', 'APR', 'MAY'];
const arr1 = ['one', 'two'];
const arr2 = [...arr1, 'three', 'four', 'five'];
console.log(arr2);
// Output:
// ["one", "two", "three", "four", "five"]
let arr1 = [1,2,3,4,5];
let arr2 = [...arr1];
arr2[0] = -2;
console.log(arr2);// outputs : [-2,2,3,4,5]
console.log(arr1);// outputs : [1,2,3,4,5]