I've been translating a JavaScript library into C# and I came across something really strange to me
The original author had a "constructor" inside a function. It was defined a way I had never seen before:
var name = function(/*parameters*/)
{
/*Set instance variables here*/
this.BMAX = 16; // maximum bit length of any code
this.N_MAX = 288; // maximum number of codes in any set
{
/*Constructor logic here*/
var a; // counter for codes of length k
var c = new Array(this.BMAX+1); // bit length count table
var el; // length of EOB code (value 256)
var f; // i repeats in table every f entries
//Etc....
}
}
Is this common practice to do this? It was the first time I have seen it done like this.
If so, can someone explain why there is an extra set of brackets? Why not just do them all in there?
Is this even "valid"?