• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

201
Vistas
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?

almost 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda