Mozilla.com

  1. 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)

Page last modified 09:20, 7 Sep 2005 by Maian

Tags:

Files (0)