function myClass(param1, param2) {
var private_member1 = param1;
var private_member2 = param2;
this.method1 = function () {
// do something
}
this.method2 = function(param1, param2) {
// do something
// you can access method1 and private member variables directly
}
}
var object1 = new myClass("one", "two");
object1.method1();
object1.method2("another param1", "another param2");
var object2 = new myClass("three", "four");
// and so on
var myClass2 = new function() {
this.method1 = function(param) {
return "this is an example";
}
// and so on, just like the example above
}