SOURCE

var str="Rome was not build in a day";
cancelSpace=str.replace(/\s+/g,"");
var count=0;
for(var i of cancelSpace){
    count++;
}
document.write("字符个数为: "+count+"<br/>");
document.write("<br/>");

var str2="abcde";
var splitStr2=str2.split("");
document.write(splitStr2+"<br/>");
var reverse=splitStr2.reverse();
document.write(reverse+"<br/>");
var strReverse=reverse.join("");
document.write(strReverse+"<br/>");
document.write("<br/>");

var sum=0;
var i=1;
for(i;i<101;i++){
    sum+=i;
}
document.write("1+2+3+…+100= "+sum+"<br/>");

var sum2=0;
var i2=1;
while(i2<101){
    sum2+=i2;
    i2++;
}
document.write("1+2+3+…+100= "+sum2+"<br/>");

var sum3=0;
var i3=1;
do{
    sum3+=i3;
    i3++;
}while(i3<101);
document.write("1+2+3+…+100= "+sum3+"<br/>");
console 命令行工具 X clear

                    
>
console