24 lines
447 B
Plaintext
24 lines
447 B
Plaintext
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
|
|
|
|
----
|
|
class Foo { }
|
|
Foo = 0; // Noncompliant
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
let Foo = class { }
|
|
Foo = 0;
|
|
----
|
|
|
|
or
|
|
|
|
|
|
----
|
|
let Foo = class Foo { }
|
|
Foo = 0;
|
|
----
|