The following string returns a length of 20 in Javascript, but why?
8080!\u001b[22m\u001b[32m\u001b[39m
\u001b is the Unicode value for Escape which is counted as a single character. With that in mind, the length is 20.
Your strings contains unicode escaped characters, this is the string character by character (using split):
var str = '8080!\u001b[22m\u001b[32m\u001b[39m';
console.log(str.split(''));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With