google scripts classes
//Here's an example of how you can imitate class behaviour in Apps Script:
var Polygon = function(height, width){
this.height = height;
this.width = width;
this.logDimension = function(){
Logger.log(this.height);
Logger.log(this.width);
}
};
function testPoly(){
var poly1 = new Polygon(1,2);
var poly2 = new Polygon(3,4);
Logger.log(poly1);
Logger.log(poly2);
poly2.logDimension();
}
//Historically Javascript is a "classless" language,
//classes are a newer feature which haven't been widely adopted yet,
//and apparently are not yet supported by Apps Script.
//Cameron Roberts: answered Oct 16 '15 at 15:31