JavaScript

JavaScript

Made by DeepSource

Too many arguments passed to function call JS-W1038

Bug risk
Minor

JavaScript allows passing more arguments to a function than needed. However, doing so makes your code less readable, and may not produce the result you would expect from the function call.

Bad Practice

function mult(a, b, c) {
  return a * b * c;
}

mult(1, 2, 3, 4); // '4' will be ignored, and the result will be '6'.
mult(...nums); // this is OK.

Recommended

function mult(a, b, c) {
  return a * b * c;
}

mult(1, 2, 3);
mult(...nums); // this is OK.