google scripts classes

Solutions on MaxInterview for google scripts classes by the best coders in the world

showing results for - "google scripts classes"
Lily-Rose
29 Nov 2019
1//Here's an example of how you can imitate class behaviour in Apps Script:
2
3var Polygon = function(height, width){
4  this.height = height;
5  this.width = width;
6
7  this.logDimension = function(){
8    Logger.log(this.height);
9    Logger.log(this.width);
10  }
11};
12
13function testPoly(){
14  var poly1 = new Polygon(1,2);
15  var poly2 = new Polygon(3,4);
16
17  Logger.log(poly1);
18  Logger.log(poly2);
19  poly2.logDimension();
20}
21
22//Historically Javascript is a "classless" language,
23//classes are a newer feature which haven't been widely adopted yet,
24//and apparently are not yet supported by Apps Script.
25
26//Cameron Roberts: answered Oct 16 '15 at 15:31
similar questions
queries leading to this page
google scripts classes