saving all arguments into an array (to then use map, etc)

PHOTO EMBED

Fri Mar 05 2021 20:13:33 GMT+0000 (Coordinated Universal Time)

Saved by @w_jellett

Alright, let's convert our arguments into an array so we can apply array methods on it 🙌

function names() {
  const argumentsArray = [...arguments];

  argumentsArray.map(name => `hi ${name}`);
  // ✅ ['hi samantha', 'hi sam']
}

names('samantha', 'sam');
content_copyCOPY

https://www.samanthaming.com/tidbits/92-6-use-cases-of-spread-with-array/