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

108
Views
Need to combine a string and a object into like query params string in JavaScript

As the titles says, I have a string and I have a object.

I have to following data

id: 2319213213

Object

{ personName: 'John', personId: 123213213, personGender: 'Male' }

Note: This object I will getting have many properties and all of them can be optional.

Need to combine these and make a string like top in JavaScript/TypeScript

Expected Result

2319213213?personId=123213213&personName=John&personGender=Male
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using URLSearchParams:

const id = 2319213213
    
const person = {
    personName: 'John',
    personId: 123213213,
    personGender: 'Male'
  }

const result = id + '?' +  new URLSearchParams(person)
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!