const a = ['to', 'code'];
const b = ['learning', ...a, 'is', 'fun'];
console.log(b); //> ['learning', 'to', 'code', 'is', 'fun']
let techlist1= ['spring', 'java'];
let techlist2= ['javascript', 'nodejs', 'mongo'];
let fullstacklist= […techlist1, …techlist2];
console.log(fullstacklist);
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