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');
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter