Non-Simple parameter lists
suggest changefunction a(x = 5) {
"use strict";
}
is invalid JavaScript and will throw a SyntaxError
because you cannot use the directive "use strict"
in a function with Non-Simple Parameter list like the one above - default assignment x = 5
Non-Simple parameters include -
- Default assignemnt
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