26 lines
745 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
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).
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
var person = new Person("John", "Doe");
var age = person.getAge; // Noncompliant; will likely return NaN
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
var person = new Person("John", "Doe");
var age = person.getAge();
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]