Non-Simple parameter lists
suggest changefunction a(x = 5) {
"use strict";
}
is a SyntaxError. A function whose parameter list is not simple cannot contain a "use strict" directive. The list above is not simple because of the default value x = 5. The same parameters are valid without that directive.
Non-Simple parameters include -
- Default assignment
function a(x = 1) {
"use strict";
}
- Destructuring
function a({ x }) {
"use strict";
}
- Rest params
function a(...args) {
"use strict";
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents