function

This is the talk page for en/JavaScript/Reference/Statements/function

Table of contents
No headers

The conditional function declaration example is actually not a function declaration; it's a function expression. For proof, try the following:

foo(); // this throws an error
if (1)
  function foo() {}

If it were a function declaration, that foo() would've worked, since function declarations are parsed first before the rest of the script.

This was discussed here: https://bugzilla.mozilla.org/show_bug.cgi?id=59112

--Maian 02:20, 7 September 2005 (PDT)

Tags (0)

Edit tags
  • No tags

Attachments (0)

 

Attach file