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

90
Vistas
Problem with array assignment in javascript

I am having a problem where I have a method where I have a data structure:

   const req = {
  ctx: {
    emails: [],
    newInvitationDto: {
      _type: 'NewInvitationDto',
      email: 'sethborne@gmail.com',
      groupId: '12345678',
      roleIds: ['organization.doctor'],
      firstName: 'Seth',
      lastName: 'Borne',
      title: 'Doctor',
      phone: '212.555.1212',
    },
  },
};

that comes from const ctx: Invitation = <Invitation>req.ctx, So when I console log ctx.emails I get an empty array.

Now when I try to push the value of email, that is 'sethborne@gmail.com' into the ctx.emails like so: ctx.emails.push(newInvitationDto.email) instead of getting a data structure like so:

['sethborne@gmail.com']

instead I get value of 1.

I believe something is wrong with my assignment, but not sure what it is.

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