Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
how do I create a string with an escaped open parens?

consider the following

➜ ~ node
Welcome to Node.js v16.15.1.
Type ".help" for more information.
> s = '('
'('
> s = '\('
'('
> s = '\\('
'\\('
> s = String.raw`(`
'('
> s = String.raw`\(`
'\\('
> s = String.raw`\\(`
'\\\\('

So, how do I set s to '\('?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You don't.

You're confused about the value of a string and its representation (whence Python repr() function).

A parenthesis is not a special character in a JavaScript string, so it will never be escaped in its canonical "code" representation. Therefore you will never make a string whose representation is '\('.

If you mean a string of length 2, with the first character being a backslash, and the second one being a left parenthesis, then '\\(' is what you want.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda