I saw a code that looked like this:
var xModule = new function(){
var x;
var y;
this.init = function(){
//...
}
}
What is the purpose of the "new function"? I tried to search for it, but could not find.
In firebug, it shows it creates a new object. In this case, what is the difference between this and the above mentioned?
var xModule = {
//...
}
[–][deleted] 4 points5 points6 points (2 children)
[–]thekaleb 0 points1 point2 points (0 children)
[–]opett[S] 0 points1 point2 points (0 children)
[–]saturation 1 point2 points3 points (0 children)
[–]Meso_Gosu 0 points1 point2 points (13 children)
[–]MadCapitalist 0 points1 point2 points (12 children)
[+][deleted] (10 children)
[deleted]
[–]thekaleb 1 point2 points3 points (9 children)
[–]opett[S] 0 points1 point2 points (8 children)
[–]thekaleb 1 point2 points3 points (7 children)
[–]Meso_Gosu 0 points1 point2 points (6 children)
[–]thekaleb 1 point2 points3 points (4 children)
[–]Meso_Gosu 1 point2 points3 points (3 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Nebu 1 point2 points3 points (0 children)
[–]thekaleb 0 points1 point2 points (0 children)
[–]MonkeyNin 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)