SOURCE

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

                    
>
console