How can I get the character count from a string in ES6?

2026-04-08 12:520阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计25个文字,预计阅读时间需要1分钟。

How can I get the character count from a string in ES6?

javascriptfunction getLength(str) { return ('' + str).match(/\S+/g).length;}

gistfile1.txt

var GetLength = function(str) { return ('' + str).match(/\S/gu).length; };

How can I get the character count from a string in ES6?