const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
const a = ['to', 'code'];
const b = ['learning', ...a, 'is', 'fun'];
console.log(b); //> ['learning', 'to', 'code', 'is', 'fun']
let femaleNames = ["Daniel", "Peter", "Joe"];
let maleNames = ["Sandra", "Lucy", "Jane"];
let allNames = [...femaleNames, ...maleNames];
console.log(allNames); // ["Daniel","Peter","Joe","Sandra","Lucy","Jane"]
// It's also important to know that we can use the same approach for as many arrays
// as we have. We can also add individual elements within the array:
let femaleNames = ["Daniel", "Peter", "Joe"];
let maleNames = ["Sandra", "Lucy", "Jane"];
let otherNames = ["Bill", "Jill"];
let moreNames = [...otherNames, ...femaleNames, ...maleNames];
let names = [...moreNames, "Ben", "Fred"];
// This saves us the stress of using a complicated syntax like the concat() method