// Here we've added multiple arguments. We want to use the first one as a rate
// to calculate all the other values with. With the rest param we put all the
// Other arguments in the `amounts` array so we can do all the array-things with them
function convertCurrency(rate, ...amounts) {
console.log(rate, amounts);
return amounts.map(amount => amount * rate);
}
const amounts = convertCurrency(1.54, 10, 23, 52, 1, 56);
console.log(amounts);
// Here we've got an array with a name and an ID as the first two values and
// A bunch of speeds The Flash ran after that. We can easily seperate those
// values by destructuring and using the rest parameter
const speedster = ['The Flash', 101, 400, 384, 985, 302];
// As everything is position based in Arrays, the first two variables will be
// the first two values of the array as well. The `...speeds` variable with rest
// operator takes in all the other values as an array.
const [name, id, ...speeds] = speedster;
console.log(name, id, speeds );
const ff4 = ['Mr. Fantastic', 'The Invisible Woman', 'The Thing', 'Human Torch'];
const [captain, assistant, ...team] = ff4;
console.log(captain, assistant, team);