Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript character count

const string = "Hello world"

const charCount = string.length //11
const charCountWithoutWhitespace = string.replace(/s/g, '').length //10
const wordCount = string.split(/s+/).length //2
const paragraphCount = string.replace(/
$/gm, '').split(/
/).length //1
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #javascript #character #count
ADD COMMENT
Topic
Name
4+6 =