标签:str i++ 字符 fun char strong ret alert div
1 function getBytes(str){ 2 var len = str.length; 3 var bytes = len; 4 for (var i=0; i<len; i++){ 5 if(str.charCodeAt[i] > 255) bytes++; 6 } 7 return bytes; 8 } 9 10 alert(getBytes());
标签:str i++ 字符 fun char strong ret alert div
原文地址:https://www.cnblogs.com/Yanss/p/12764616.html