Create more flexible functions with default values and a variable number of arguments.
ES6 introduced two powerful features that make functions more flexible and easier to work with: default parameters and rest parameters. Default parameters allow you to assign a default value to a function's parameter in the function definition itself. If a caller invokes the function without providing a value for that parameter (or provides `undefined`), the default value will be used automatically. This eliminates the need for boilerplate code inside the function (like `name = name || 'Guest'`) to check for missing arguments, leading to cleaner and more readable function signatures. Rest parameters provide a simple way to handle functions that accept a variable number of arguments. By prefixing the last parameter in a function definition with `...` (three dots), you can collect all remaining arguments passed to the function into a standard JavaScript array. This is a more modern and intuitive alternative to the older `arguments` object, which is not a true array and can be awkward to work with. The rest parameter gives you access to all array methods like `map`, `filter`, and `reduce`, making it much easier to process a variable number of inputs.