Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

185
Vistas
How to declare Class fields in Google App Script using javascript

I'm trying to create a class with some fields on Google Scripts. I can't even save the file. From what I understand of this SO answer, I'm using the correct syntac for class fields.

V8 runtime is enabled.

The error:

Syntax error: ParseError: Unexpected token = line: 5 file: Airtable_Class.gs

Line 5 is: foo = "bar";

Here's the whole code:

class FieldsTest{
  foo = "bar";
}

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

This is a known issue. Add a star (★ on top left) to the issue, if you want this to be implemented.

https://issuetracker.google.com/issues/195752915

According to the tracker, it is supported, but it is blocked by the parser.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Although it seems that Google Apps Script doesn't support static class fields, it does support static methods/getters/setters, so you can do this:

class X {
   // ⭐️ static getters & setters
   static get a(){ return this._a || 0 }     // this === X
   static set a(value){ this._a = value }    // this === X
}

then you can get/set X.a as usual:

X.a      // get: 0.0
X.a = 3  // set: 3.0
X.a      // get: 3.0
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda