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

169
Views
Combine array in JavaScript with underscore character
 Var a = "837297,870895"
 Var b = "37297,36664"

OutPut = "837297_37297,870895_36664

I tried multiple script but does not working

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

0

You can split and map the splitted array as such:

var a = "837297,870895" 
var b = "37297,36664"

var output = a.split(',').map((e,i)=> e+"_"+b.split(',')[i])
console.log(output.toString())

For ES2015 or lower

var a = "837297,870895" 
var b = "37297,36664"

var output = a.split(',').map(function(e,i){return e+"_"+b.split(',')[i]})
console.log(output.toString())

about 4 years ago · Juan Pablo Isaza Report

0

You can start by converting the two strings (lists) into arrays using .map() and .split() methods. Then use .map() and .join() methods to produce the desired string (list):

const a = "837297,870895";
const b = "37297,36664";

const [c,d] = [a,b].map(e => e.split(','));

const output = c.map((e,i) => `${e}_${d[i]}`).join();

console.log( output );

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!