Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

425
Vistas
Double quote escape is giving Uncaught SyntaxError: missing )

I Have an issue where user last name(adfs2"k) which has double quote, whenever I need to edit the last name and click on a button, it throws an error

Uncaught SyntaxError: missing ) after argument list

I have tried the double quote escape, but it still throws

lastName = lastName.replace(/\"/g,"\\\"");

and this is the function, i'm using

"javascript:editUserEmailPopup(' + "'" + firstName + "'" + ',' + "'" + lastName + "'" + ');"
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As @T.J. Crowder suggests in his comment, one cause of this issue is embedding your function call within an HTML attribute. Using these inline-event-handlers can lead to problems like this as well as unmanageable code. The alternative is to use an external script tag, or to inline a script tag.

However, even within an isolated script, this code has some issues that make it unclear what it should even do and does not work. I believe the code is meant to return the firstName variable surrounded by double quotes, followed by the lastName variable surrounded by single quotes. The code is unclear but this solution should be able to fix it:

const firstName = 'asd5"3'
const lastName = "jfni8'543"
console.log(`"${firstName}", '${lastName}'`)

This syntax of embedding variables into strings and being able to use double quotes and single quotes without escaping them is called Template literals:

Template literals are enclosed by the backtick ( ) (grave accent) character instead of double or single quotes.
Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). The expressions in the placeholders and the text between the backticks ( ) get passed to a function.
(From MDN)

about 4 years ago · Juan Pablo Isaza Denunciar
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda