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

233
Visualizações
Does String.prototype.normalize() method guarantees the same abstract character equal?

I found normalize method on MDN.

Assume the API response from the server-side is like this: {name: "李"}. The Unicode of the 李 is \uF9E1.

Now, on client-side, can we use it in the if...else... condition like this:

// We type the '李' string, the unicode of this '李' is \u674E
if(name.normalize() === '李'.normalize()) {
   // do something
}

Does String.prototype.normalize() method guarantees the same abstract character equal? So that we can compare these abstract characters in the condition with no worry.

Or, the best practice is never to return data with abstract characters in API and compare them? Instead, we should return the data from server-side like {name: '李', code: 0 } and use the code field(number data type) to compare.

about 4 years ago · Juan Pablo Isaza
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