24 lines
430 B
Plaintext
24 lines
430 B
Plaintext
== Why is this an issue?
|
|
|
|
Giving both a variable and a function with the same name in a single scope should be avoided. This usage is confusing and should be avoided because it will be unclear whether the named variable refers to the function or to something else.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
var fun;
|
|
function fun() {
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
var fun = function fun() {
|
|
}
|
|
----
|
|
|