Open Bug 1408616 Opened 2 years ago Updated 2 years ago

Re-Introduction to JavaScript - Functions: hiding local variables


(Developer Documentation :: JavaScript, enhancement, P3)



(Not tracked)



(Reporter: darren_adkinson, Unassigned)




:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

Where the text starts "JavaScript lets you create anonymous functions":

there are several things that appear wrong with the example given, afaict:

1. it's an IIFE shown before IIFE is introduced or explained,
2. it doesn't need to be an anonymous function in order to do its job
3. the text: "It's extremely powerful, [referring to anonymous functions] as it lets you put a full function definition anywhere that you would normally put an expression." seems confusing as it conflates anonymous functions with the ability to create IIFEs.
4. there's no explanation of the brackets used to sidestep problems with the JS engine interpreting the function expression as a function declaration. Suggest showing at least two common forms (function{})(); and (function(){}()); as well as (perhaps, though this is debatable) the use of "void function" as another way to achieve this.
made a mistake with the two common forms of IIFE, should be: 


Priority: P5 → P3

I am currently looking for bugs to fix as part of my Open Source Development module at Coventry University and I am interested in developing this bug.

Please could you assign this task to me and give me more information.

This is my first bug fix and any help would be appreciated.

Thank you.
You need to log in before you can comment on or make changes to this bug.