O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Consider this

By looking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required