JavaScript Non-Simple parameter lists


Example

function 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";
}