rest params in function
// Example 1
function convertCurrency(rate, tax, tip, ...amounts) {
console.log(`rate:${rate}, tax:${tax}, tip:${tip}, amounts:${amounts}`)
return amounts.map(amount => amount * rate)
}
const amounts = convertCurrency(1.54, 10, 23, 52, 1, 56)
console.log('Amounts '+ amounts)
// output: Amounts 80.08,1.54,86.24000000000001
// Example 2
const runner = ['Wes Bos', 123, 5.5, 5, 3, 6, 35]
const [name, id, ...runs] = runner
console.log(name, id, runs)
// output: Wes Bos 123 Array(5)
// Example 3
const team = ['Wes', 'Kait', 'Lux', 'Sheena', 'Kelly']
const [captian, assistant, ...players] = team
console.log(captian, assistant, players)
// output: Wes Kait Array(3)