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

122
Vistas
Getting undefined in the array of strings

I have the following Javascript code:-

    const mainFunction = async (message) => {
      const templateData = {};
      templateData.name = message.firstName;
      templateData.email = message.emailAddress;  
      templateData.account = message.accountType;
      console.log("message::::", message);
      const userId = message.userId;
    
      const emailAddresses = [`${message.emailAddress}`];
      console.log("emailAddresses->", emailAddresses);
}

Logs:-

2022-03-10T14:33:50.807+05:30

Copy
2022-03-10T09:03:50.806Z    8681ec6b-7f57-5148-bdd3-b6c8be7d2f15    INFO    message:::: 
{
    "userId": "b4c6cab0-a944-5f5e-81cd-b1dad4c0b54a",
    "emailAddress": "tom.dick9000@gmail.com",
    "notificationType": "NEW_USER_WELCOME_MESSAGE",
    "firstName": "tom",
    "lastName": "dick",
    "accountType": "BASIC"
}

2022-03-10T09:03:50.806Z 8681ec6b-7f57-5148-bdd3-b6c8be7d2f15 INFO message:::: {"userId":"b4c6cab0-a944-5f5e-81cd-b1dad4c0b54a","emailAddress":"tom.dick9000@gmail.com","notificationType":"NEW_USER_WELCOME_MESSAGE","firstName":"tom","lastName":"dick","accountType":"BASIC"}

2022-03-10T14:33:50.807+05:30   2022-03-10T09:03:50.807Z 8681ec6b-7f57-5148-bdd3-b6c8be7d2f15 INFO emailAddresses-> [ 'undefined' ]

The problem is the constant emailAddress is coming as undefined but the value of the emailAddress attribute is present in the object message. I want to pass the dynamic value to this array of Strings but not working at all.

Please let me know why it is coming as undefined. Thanks

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