javascript nested function "is not defined"

RESOLVED DUPLICATE of bug 585536

Status

()

Firefox
Untriaged
RESOLVED DUPLICATE of bug 585536
3 years ago
3 years ago

People

(Reporter: demidov, Unassigned)

Tracking

36 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20150305021524

Steps to reproduce:

Look at
http://www.ibiblio.org/e-notes/Splines/garden/test_ff.htm

function webGLStart() {
...
function apples(tx,ty,tz){
   apple(.05, 0);
}
function apple(age, tyb){
...
    patch_rot();

 function patch_rot(){
 ...
 }
} // end  apple()
} // end  webGLStart()



Actual results:

ReferenceError: patch_rot is not defined


Expected results:

the script works fine in Chrome and IE

Comment 1

3 years ago
Your sample is

function webGLStart() {
...
function apples(tx,ty,tz){
   apple(.05, 0);
}
function apple(age, tyb){
  ...
  for (...;...;...) {
    patch_rot();

    function patch_rot(){
      ...
    }
  } // end for

} // end  apple()
} // end  webGLStart()


So function patch_rot() is not a function declaration.
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions#Function_constructor_vs._function_declaration_vs._function_expression

Comment 2

3 years ago
Dupe Bug 1071877 ?
(Reporter)

Comment 3

3 years ago
sorry,
occasionally I put function constructor  "patch_rot(" into a "for" cycle,
but I was misled by Chrome and IE.

Comment 4

3 years ago
The original testcase is down, I'm guessing it didn't use the strict mode, so it's a dupe of 585536.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 585536
You need to log in before you can comment on or make changes to this bug.