Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How to use static method in google app script

In google app script,static is not a keyword,how to use this method in google app script?

class Test{
  constructor(a){
    this.a = a;
  }
  static trythis(b,c){
    return b*c;
  }
}


function test123(){
  let test = new Test(123)
  Logger.log(test)
  let test2 = trythis(2,3)
  Logger.log(test2)
} 

ReferenceError: trythis is not defined

https://i.stack.imgur.com/HovHd.png

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Just like in JavaScript:

class Test{
  constructor(a){
    this.a = a;
  }
  static trythis(b,c){
    return b*c;
  }
}


function test123(){
  let test = new Test(123)
  console.log(test)
  let test2 = Test.trythis(2,3) // like this
  console.log(test2)
} 

test123();

EDIT

Proof that it works in Apps Script

enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!