Thursday, 12 September 2013

function declaration within function declaration with same name javascript

function declaration within function declaration with same name javascript

I've just seen this pattern in javascript:
var test = function () {
function test(args) {
this.properties = args || {}; //etc
}
}
test.prototype.methodName = function (){} //...etc
What is going on with the function definition; declared once outside and
once inside. What is the value of this approach?

No comments:

Post a Comment