I have a really simple script that creates a large string
window.big = '';
for(let c = 0; c < 12000; c++){
window.big += 'L'
}
Things get weird when I try to console.log
it.
window.big.length
is 12000, however, when I try to do console.log(window.big)
in Chrome Dev Tools, it says Show more (23.4 KB)
, more than double the original size, which was 12000.
String.length
may be different compared to the byte size of the characters, however, things get interesting when you try to do
var blob = new Blob([window.big], {type: 'application/octet-stream'});
window.open(window.URL.createObjectURL(blob));
which showed a size of 12KB
Replicated the issue on Chrome OS, Chrome Version 80.0.3987.162 (Official Build) (64-bit)