Does the below code create multiple instances of function fun1 when multiple instance of tempobj are created?. I know that separate instances of fun2 are created for each object. I need to know if the same will happen for fun1 too.
function tempobj(){
var fun1 = function(){
//do something;
}
this.fun2 = function(){
//do something;
}
}
var obj1 = new tempobj();
var obj2 = new tempobj();
var obj3 = new tempobj();
The answer is yes , you are defining the fun1 each time you create an object.