题解 | #获取字符串的长度#
获取字符串的长度
https://www.nowcoder.com/practice/e436bbc408744b73b69a8925fac26efc
function strLength(s, bUnicode255For1) { if(bUnicode255For1){return s.length} let count =0; s.split('').forEach(item=>count+=item.charCodeAt()>255?2:1); return count }