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

250
Views
Parsing Javascript cookie values and separating values

I'm still learning Javascript and I'm trying to parse a value from a cookie in a specific key:

I'm using this current line:

const cookieObj = new URLSearchParams(document.cookie.replaceAll("; ","&","|")) cookieObj.get("LG_AFF_TRK")

LG_AFF_TRK is the key that I'm pulling the value from. Doing so creates the output value of the following:

1|2|3|4|5|6

Each number represented would be a value that will have a random number of characters -and- could possibly be empty but each section always be separated by the "|" symbol.

How can I pull a specific value? As an example question, what do I need to do pull value 3?

I'm trying to understand this logically and my guess is I have to create an array first?

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!