This is my Class
MyFunction = function(args) {
var parameter1 = args.parameter1;
var parameter2 = args.parameter2;
var ObjId = args.ID;
function getData(callback) {
// Some code for getting data;
}
someFunction = function() {
// Some calculation
}
someFunction2 = function() {
//Some calculation
}
Now I am creating two objects of this class. myObj1
and myObj2
var args1 = {
parameter1 : "x",
parameter2 : "Y",
ObjId : "ID1"
}
var myObj1 = new MyFunction(args1);
var args2 = {
parameter1 : "x",
parameter2 : "Y",
ObjId : "ID1"
}
var myObj2 = new MyFunction(args2);
// Third way. Don't know it is correct or not.
new MyFunction(args2);
When I am creating myObj1
or myObj2
my code will reach to MyFunction
class and all the methods inside the class like someFunction
,someFunction2
and getData
with reference to respective args will execute.
My question is
- After execute Javascript class, what happened to objects later.
- If all the methods present inside the will execute by
var myObj1 = new MyFunction(args1);
then when to usemyObj1.someFunction()
Am I misiing anything ?