var s =parseInt(Math.random()*899+100)
var str = s + ""
var result = ''
for(var i =0;i<str.length;i++){
result +=translateToCh(str.charAt(i),i) //charAt()方法可返回指定位置的字符。
}
console.log(result)
function translateToCh(num,pos){
var arr = ['零','一','二','三','四','五','六','七','八','九']
var str = arr[num]
switch(pos){
case 0:
str += "百"
break
case 1:
if(num!=0)
str += "十"
break
case 2:
if(num==0){
str=""
}
break
}
return str
}