7 lines
457 B
Plaintext
7 lines
457 B
Plaintext
Variables declared with <code>var</code> have the special property that regardless of where they're declared in a function they "float" to the top of the function and are available for use even before they're declared. That makes scoping confusing, especially for new coders.
|
|
To keep confusion to a minimum, <code>var</code> declarations should happen before they are used for the first time.
|
|
|
|
include::../noncompliant.adoc[]
|
|
|
|
include::../compliant.adoc[]
|