Push array into a new array
// plain vanilla js
// inventors.push.apply(inventors, newInventors)
inventors.push(...newInventors)
console.log(inventors);
// es6 version - using spread
const inventors = ['Einstein', 'Newton', 'Galileo'];
const newInventors = ['Musk', 'Jobs'];
const name = ['Joe', 'Boo'];
function sayHi(first, last) {
alert(`Hey there ${first} ${last}`);
}
sayHi(...name);
// old way
// sayHi(name[0], name[1]);