Can `toLowerCase` change a JavaScript string’s length?

Is it ever possible that string.length !== string.toLowerCase().length?

I know it is possible for toUpperCase, given the answers at Change to .length with toUpperCase?, but I don’t know whether it’s possible for toLowerCase.

Answer

Yes, it’s possible, not all case mappings are one to one as you’ve seen when going from lowercase to uppercase, the same can apply when going from uppercase to lowercase, for example:

const char = "İ";
const charLower = char.toLowerCase();
console.log(char, char.length); // İ 1
console.log(charLower, charLower.length); // i̇ 2
console.log(char.length !== charLower.length); // true

There is a note in the specification that also highlights this behavior at section 22.1.3.26:

The case mapping of some code points may produce multiple code points. In this case the result String may not be the same length as the source String