SOURCE

console 命令行工具 X clear

                    
>
console
var str ="Rome was not built in a day";
str=str.replace(/\s+/g,"");//去掉所有的空格
var sum =0;
for(var i of str)//for...of循环遍历字符串
{
    sum++;
}
document.write("Rome was not built in a day有"+sum+"个字符串");
<!DOCTYPE html> 
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
    </script>
</head>
<body>
</body>
</html>