Kmspico Download | Official KMS Activator Website [New Version 2024] Fast and Easy Converter YouTube to MP3 Online KMSAuto Net Activator Download 2024 Immediate Byte Pro Neoprofit AI Blacksprut without borders. Discover new shopping opportunities here where each link is an entrance to a world ruled by anonymity and freedom.

How to Count String Words Using JavaScript?

Hello friends, today I will tell you through this tutorial how you can count any string word by javascript. I will tell you step by step through this tutorial.

Count Words Using JavaScript or Jquery, Count Words with JavaScript, Count Words in String Using JavaScript, How to Count Words by JavaScript or Jquery?

<!DOCTYPE html>
<title>How to Count Words Using JavaScript?</title>
<h1>Count Words Using JavaScript</h1>
<textarea name="stringvalue" id="stringvalue" cols="50" rows="4">How to Count Words Using JavaScript?</textarea>
<input type="button" name="Convert" value="Count Words" onclick="countstringWords();"> 
<input name="wordcount" id="wordcount" type="text" value="">
function countstringWords(){
svalue = document.getElementById("stringvalue").value;
svalue = svalue.replace(/(^\s*)|(\s*$)/gi,"");
svalue = svalue.replace(/[ ]{2,}/gi," ");
svalue = svalue.replace(/\n /,"\n");
document.getElementById("wordcount").value = svalue.split(' ').length;