Lesson 15. Default parameters and rest
After reading lesson 15, you will
- Know how to use default parameters
- Know how to gather parameters with the rest operator
- Know how to use rest to pass arguments between functions
Sometimes new language features provide ways to achieve things that were impossible or nearly impossible to do before. Other times they simply add a nicer way of achieving something that was already easily implemented. But just because something is easy to implement or requires few lines of code to do, doesn’t necessarily make it readable. That’s exactly what default function parameters and rest parameters do: they provide a more concise and much more readable way of achieving something.
By looking ...
Get Get Programming with JavaScript Next now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.