I understand that you can use the spread operator syntax with parameters (Rest Parameters) when defining a function in es6 , like so:
function logEach(...things) {
things.forEach(function(thing) {
console.log(thing);
});
}
logEach("a", "b", "c");
// "a" // "b" // "c"
My question :
Can you use the default parameter along with the spread syntax ? This doesn't seem to work:
function logDefault(...things = 'nothing to Log'){
things.forEach(function(thing) {
console.log(thing);
});
}
//Error: Unexpected token =
// Note: Using Babel