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

190
Visualizações
How to add a Byte to an hexadecimal escape sequence in JS

I have a little problem with javascript and since I don't have a very high level, I would need some help please.

Demonstration with hash

Actually I have a "string" of bytes that I have to hash. The problem being that I have to add another byte to it that I generate in a script. I can't add this one all at once (ie do "+ '\x25'") because I have to add the 1st digit first and then the 2nd. But when I concatenate the new byte, it is interpreted as 4 character instead of one, namely "\", "x", "2", "5" instead of "%". Would there be a way to add the byte without translating it into ASCII?

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

0

Try this:

const firstDigit = 2;
const secondDigit = 5;
const number = `${firstDigit}${secondDigit}`;

const charToAdd = String.fromCharCode(Number.parseInt(number, 16));

console.log(charToAdd);

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