SOURCE

function writeDocument(variable) {
    document.write(variable + "<br/>");
}


var a="Rome was not built in a day";
var aa=a.replace(/\s*/g,"");
var sum=0;
for(var i of a){
    sum++;
}
writeDocument("字符串中字符的个数:"+sum);
console 命令行工具 X clear

                    
>
console