Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #66 from devinrhode2/patch-1

Added note about var fn = function fn( breaking IE
  • Loading branch information...
commit adb75704925723b1a8c0e42d143f89ca4867ddd2 2 parents d2905df + 4a9429d
@shichuan authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 general-patterns/function-declarations.html
View
14 general-patterns/function-declarations.html
@@ -30,15 +30,25 @@
* 1. Provides the debugger with an explicit function name: helps stack inspection.
* 2. Allows recursive functions: getData can call itself.
* Issues:
- * 1. there are historic quirks with IE
+ * 1. Can break IE, coffeescript doesn't do function names:
+ * https://github.com/jashkenas/coffee-script/issues/366
*/
var getData = function getData () {
};
+ // 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/
</script>
</body>
-</html>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.