Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!