== Why is this an issue? Consistent naming between arguments and parameters reduces the chances of making mistakes, such as passing the wrong value to a parameter or omitting an argument in a function call. When the names of arguments in a function call match the names of the function parameters, it contributes to clearer, more readable code. However, when the names match but are passed in a different order than their declaration in the function signature, it may indicate a mistake in the parameter order, likely leading to unexpected results. [source,javascript,diff-id=1,diff-type=noncompliant] ---- function divide(dividend, divisor) { return dividend / divisor; } function doTheThing() { const dividend = 15; const divisor = 5; const result = divide(divisor, dividend); // Noncompliant: not the expected result //... } ---- Ensure that the arguments passed to the function are in the correct order, according to the function signature. [source,javascript,diff-id=1,diff-type=compliant] ---- function divide(dividend, divisor) { return dividend / divisor; } function doTheThing() { const dividend = 15; const divisor = 5; const result = divide(dividend, divisor); //... } ---- === Exceptions Swapped arguments that are compared beforehand in an enclosing ``++if++`` statement are ignored: [source,javascript,diff-id=1,diff-type=compliant] ---- function divide(dividend, divisor) { return dividend / divisor; } function doTheThing() { const dividend = 5; const divisor = 15; if (divisor > dividend) { const result = divide(divisor, dividend); //... } } ---- == Resources === Documentation * MDN web docs - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions[Functions] ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Arguments to "xxx" have the same names but not the same order as the function parameters. include::../highlighting.adoc[] ''' == Comments And Links (visible only on this page) include::../comments-and-links.adoc[] endif::env-github,rspecator-view[]