
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.
51 lines
822 B
Plaintext
51 lines
822 B
Plaintext
== Why is this an issue?
|
|
|
|
A class declaration also creates a variable with the same name. It is possible to change the value of that variable but this is most likely an error. Even in the best-case scenario, where this is intentional, this is very confusing and should be avoided.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
class Foo { }
|
|
Foo = 0; // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
let Foo = class { }
|
|
Foo = 0;
|
|
----
|
|
|
|
or
|
|
|
|
|
|
[source,javascript]
|
|
----
|
|
let Foo = class Foo { }
|
|
Foo = 0;
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Change this variable's name to be different from the class name.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
Primary: Variable
|
|
|
|
Secondary: Class declaration
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|