render: function render(context, partials) { return this.r(context, partials); },
Given this code from the new hogan.js Twitter library to demonstrate this problem; what is the purpose of naming a function twice?
If it were necessary, the function rendercould call itself throughrender() , but is render()not available elsewhere .
render
render()
In addition, in the stack trace, you will see renderas the name of the function, not anonymous function.
anonymous function
This is necessary for a recursive call.
- , ,
object.render(context, partials);
. .
, , .
var render = function render(n) { console.log("render"); if (n < 1) render(n + 1); }; render(0);
Edit: Sorry, I wrote something really wrong in the first revision.