(und selbst wenn, dann könnte ich mir vorstellen, daß es einen Konflikt gibt, wenn Du sowohl eine Variable als auch eine Funktion mit demselben Namen hast - Konflikt in dem Sinne, daß das, was als zweites definiert wird, das erste überschreibt)
Die Reihenfolge spielt keine Rolle, es ist definiert, dass Funktionsdeklarationen gewinnen.
Funktionen sind Variablen. Bei Deklaration von Variable und Funktion gewinnt die Funktion, siehe Entering Function Code und Declaration Binding Instantiation in ECMAScript 5.1:
»5. For each FunctionDeclaration f in code, in source text order do
a. Let fn be the Identifier in FunctionDeclaration f.
b. Let fo be the result of instantiating FunctionDeclaration f as described in Clause 13.
c. Let funcAlreadyDeclared be the result of calling env’s HasBinding concrete method passing fn as the argument.
d. If funcAlreadyDeclared is false, call env’s CreateMutableBinding concrete method passing fn and configurableBindings as the arguments.
…
8. For each VariableDeclaration and VariableDeclarationNoIn d in code, in source text order do
a. Let dn be the Identifier in d.
b. Let varAlreadyDeclared be the result of calling env’s HasBinding concrete method passing dn as the argument.
c. If varAlreadyDeclared is false, then
i. Call env’s CreateMutableBinding concrete method passing dn and configurableBindings as the arguments.
ii. Call env’s SetMutableBinding concrete method passing dn, undefined, and strict as the arguments.«
Auf Deutsch, varAlreadyDeclared ist true, wenn bereits eine gleichnamige Funktion deklariert wurde, also wird kein Binding mehr angelegt.
var foo;
function foo () {}
alert(foo); // function foo () {}
Die Reihenfolge spielt hier keine Rolle, weil beide Deklarationen gehoistet werden.
Mathias