
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
43 lines
1003 B
Plaintext
43 lines
1003 B
Plaintext
== Why is this an issue?
|
|
|
|
When an object method is assigned to a variable, it is most likely a mistake: the parentheses have been left off the method invocation. When this is actually done on purpose, it will llikely yield unpredictable results since the method will have been designed to work in a different scope (the scope of the object) than it will execute in (the global scope).
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
var person = new Person("John", "Doe");
|
|
var age = person.getAge; // Noncompliant; will likely return NaN
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
var person = new Person("John", "Doe");
|
|
var age = person.getAge();
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Make this use of "xxx" a function call or remove it altogether.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 12 Nov 2015, 18:26:30 Linda Martin wrote:
|
|
OK!
|
|
|
|
endif::env-github,rspecator-view[]
|