var welcomestring ="Welcome"
document.write(welcomestring+"<br>")
document.write(welcomestring.length+"<br>")
document.write(welcomestring.toLowerCase()+"<br>")
document.write(welcomestring.toUpperCase()+"<br>")
document.write(welcomestring.charAt(1)+"<br>")
document.write(welcomestring.substring(3)+"<br>")
document.write(welcomestring.substring(3,4)+"<br>")
var stence="we have fun in our class"
function write(variable){
document.write(variable+"<br>");
}
document.write(stence.replace("class","pro class")+"<br>")
document.write(stence.replace(/class/g,"pro glass")+"<br>")
document.write(stence.split(" ")+"<br>")
document.write(welcomestring.split("")+"<br>")
document.write(stence.split("")+"<br>")
document.write(stence.indexOf("c")+"<br>")
document.write(stence.lastIndexOf("class")+"<br>")
document.write(stence.match("c")+"<br>")
var longstring ="Can you can a can as aCaner can can a can"
function countchar(string,cahr){
var charcount=0;
var bool
for(var i=0;i<=string.length;i++){
if(string.charAt(i).toLowerCase()==cahr)
++charcount
}
return charcount
}
function countNumber(stringtoCount) {
var numCount = 0;
for(var i=0;i<stringtoCount.length;i++){
if(isNaN(stringtoCount.substring(i,i+1))==false){
numCount++
}
}
return numCount;
}
var juzi="sadwd12345sdad67w"
document.write(countchar(longstring,"c")+"<br>")
document.write("字符串中一共"+countNumber(juzi)+"个数字"+"<br>")
console