2023年11月23日

js如何计算字符串的字节数

摘要: 如果计算字符长度只需要使用length, let str = "hello世界"; console.log(str.length)//7 如何计算所占用的字节数呢? function getByteLength(str) { let length = 0; for (let i = 0; i < s 阅读全文

posted @ 2023-11-23 11:43 久居我梦 阅读(160) 评论(0) 推荐(0) 编辑

导航