Hi, your rest example is actually still just spread syntax! The definition you included is correct:
rest
Rest: allows a function to accept an indefinite number of arguments as an array
But your example isn't a function. Here's what it would look like using rest:
function logFullName(firstName, ...familyName) { console.log(firstName); console.log(familyName); } logFullName("Robert", "Alfred", "Cole");
Ah! Thank you for pointing that out! I'll make that change, thanks Bryce!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, your
rest
example is actually still just spread syntax! The definition you included is correct:But your example isn't a function. Here's what it would look like using
rest
:Ah! Thank you for pointing that out! I'll make that change, thanks Bryce!