samedi 8 octobre 2016

Does a JavaScript function declaration return a reference to a function or not?

In the book "Head First Javascript" on pages 464 and 465 there are two statements that are contradicting.

p 464

When the browser evaluates a function declaration, it creates a function as well as a variable with the same name as the function, and stores the function reference in the variable.

p 465

A function declaration doesn't return a reference to a function; rather it creates a variable with the name of the function and assigns the new function to it.

So which one is it? When the interpreter looks at a function declaration, creates a variable- does it assign a function or a function reference to that variable?




Aucun commentaire:

Enregistrer un commentaire