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

234
Vistas
When passing a variable to function, variable.length return a TypeError

Sample code in Google Apps Script

function myFunction(n) {
  Logger.log(n); /* expected output: "n" */
  Logger.log(n.length) /* expected output: 1 */
  return n;
}

Logger.log(myFunction("n")); /* expected output: "n" */

Execution log

21.35.48    Info    n
21.35.48    Info    1.0
21.35.48    Info    n
21.35.48    Info    null
21.35.48    Error   TypeError: Cannot read property 'length' of undefined myFunction @ Test.gs:3

Granted I come from a Python background and this is my first project in Javascript, however I don't have a single idea on why the log shows TypeError. In my project, I can't read the length of 'n' and always quits with error.

Any help is much appreciated!

about 4 years ago · Juan Pablo Isaza
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