SOURCE

var str="Rome was not built in a day";
var str1=str.replace(/\s+/g,"");
var count=0;
for (var ch of str1) {
    count++;
}
document.write(count)
console.log(count);
console 命令行工具 X clear

                    
>
console