Skip to content

Commit

Permalink
Merge pull request chuanxshi#69 from devinrhode2/patch-1
Browse files Browse the repository at this point in the history
consolidated 3RD and 4TH recommendation
  • Loading branch information
chuanxshi committed Jun 25, 2013
2 parents 60482cb + 3436538 commit 86337d9
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions general-patterns/function-declarations.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,12 @@

// named function expression
/* Benefits:
* 1. Provides the debugger with an explicit function name: helps stack inspection.
* 2. Allows recursive functions: getData can call itself.
* Issues:
* 1. Can break IE, coffeescript doesn't do function names:
* https://github.com/jashkenas/coffee-script/issues/366
* 1. Get's rid of (anonymous functions) when inspecting and debugging
* 2. Doesn't break IE with the added 'Fn' (function name is not the same as the identifier)
*/
var getData = function getData () {
var getData = function getDataFn () {
};

// named function expression + 'F'
/* Benefits:
* 1. Get's rid of (anonymous funciton) in stack traces
* 2. Recurse by calling the name + 'F'
* 3. Doesn't break an IE (well, unless there's a function name collision of the sort described here: https://github.com/jashkenas/coffee-script/issues/366#issuecomment-242134)
*/
var getData = function getDataF () {
};


// References
// http://ejohn.org/blog/javascript-as-a-first-language/
// http://kangax.github.com/nfe/
Expand Down

0 comments on commit 86337d9

Please sign in to comment.