45 lines
852 B
Plaintext
45 lines
852 B
Plaintext
You can easily call a JavaScript function with more arguments than the function needs, but the extra arguments will be just ignored by function execution.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,javascript]
|
|
----
|
|
function say(a, b) {
|
|
print(a + " " + b);
|
|
}
|
|
|
|
say("hello", "world", "!"); // Noncompliant; last argument is not used
|
|
----
|
|
|
|
== Exceptions
|
|
|
|
No issue is reported when ``++arguments++`` is used in the body of the function being called.
|
|
|
|
|
|
----
|
|
function doSomething(a, b) {
|
|
compute(arguments);
|
|
}
|
|
|
|
doSomething(1, 2, 3) // Compliant
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|