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

185
Vistas
Why normalize() method doesn't work in some cases?

By default, String.prototype.normalize() uses NFC as an argument. NFC replaces multiple characters with single one.

MDN

You can specify "NFC" to get the composed canonical form, in which multiple code points are replaced with single code points where possible.

And here's an example from MDN. It works.

let str = '\u006E\u0303';
str = str.normalize();
console.log(`${str}: ${str.length}`);

But then I decided to try this method with other characters. For example:

let str = '\u0057\u0303';
str = str.normalize();
console.log(`${str}: ${str.length}`);

What's wrong in the second example? Why doesn't it work?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It doesn't replace multiple characters it replaces multiple codepoints and only where possible.

ñ, being a character used in Spanish has its own codepoint in unicode: — U+00D1 — so you can just say ñ instead of "Take an n and then put a ~ on top of it".

W̃, being a representation of a phonic sound doesn't have its own codepoint. It is a character used comparatively rarely so hasn't been given precious space in the more efficient bits of Unicode. The only way you can have one is to say "Take a W and then put a ~ on top of it".

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