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

67
Views
How to transform array in string of new string with comma and parentheses

I have a array of values that I want to transform in a new value of strings to do a query in a external service that accept the query like this:

/v53.0/query/?q=SELECT+Id,Name,Field FROM Table WHERE Field IN ('a0C7X0000056xmxUAA', 'a0C7X0000056x9EUAQ', 'a0C7X0000056x99UAA')

example:

I have this code that transform the array:

mapIdGRD__c.map((num) => {
        return String(num);
      });

In this:


[
  'a0C7X0000056xmxUAA',
  'a0C7X0000056x9EUAQ',
  'a0C7X0000056x99UAA',
  'a0C7X0000056x8YUAQ',
  'a0C7X0000056wmxUAA',
  'a0C7X0000056wmsUAA',
  'a0C7X0000056wmnUAA',
  'a0C7X0000056wmYUAQ',
  'a0C7X0000056wmTUAQ',
  'a0C7X0000056wmOUAQ'
]

And I want to transform in a new string separated with comma and parentheses like this:

(  'a0C7X0000056xmxUAA',
  'a0C7X0000056x9EUAQ',
  'a0C7X0000056x99UAA',
  'a0C7X0000056x8YUAQ',
  'a0C7X0000056wmxUAA',
  'a0C7X0000056wmsUAA',
  'a0C7X0000056wmnUAA',
  'a0C7X0000056wmYUAQ',
  'a0C7X0000056wmTUAQ',
  'a0C7X0000056wmOUAQ'
)

Is possible using some standard lib of javascript?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can do this

const array = [
  'a0C7X0000056xmxUAA',
  'a0C7X0000056x9EUAQ',
  'a0C7X0000056x99UAA',
  'a0C7X0000056x8YUAQ',
  'a0C7X0000056wmxUAA',
  'a0C7X0000056wmsUAA',
  'a0C7X0000056wmnUAA',
  'a0C7X0000056wmYUAQ',
  'a0C7X0000056wmTUAQ',
  'a0C7X0000056wmOUAQ'
]

const result = `(${array.map(n => `'${n}'`).join(', ')})`

console.log(result)

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