I know I can use rest spread to make any number of function arguments available as a named array:
function logArgs(...args) {
console.log(args);
}
logArgs(1, "a", {});
For specified function parameters, it is also possible to define a default value right in the function signature:
function logA(a = 1) {
console.log(a);
}
logA();
logA(2);
Question: Why does using both throw a Rest parameter may not have a default initializer
error?
function logArgs(...args = [1]) {
console.log(args);
}
logArgs(1, "a", {});
logArgs();