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

352
Vistas
Uncaught ReferenceError: function is not defined error for 1 function

I think it's a very common problem but I've a code like this:

function add(num1, num2) {
  return num1 + num2;
}

function hello() {
  return "Hello";
}
window.alert("Num1 + Num2 = " + add(10, 5));

window.alert(hello());

The thing is, add() function works perfectly but try() is not. Why? I am working on Visual Studio Web Application.

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

0

Its becuase try is a reserved keyword in javascript as in try-catch, similarly you cannot use keywords like let, const, var, do, for ... etc as variable names or function declarations, change your function name to hello or something else and it should work perfectly fine

about 4 years ago · Juan Pablo Isaza Denunciar

0

That's because try is a reserved word, have you ever seen

try {

}catch(e){}

So change the name of the function, simply use try1()

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