how to count a character in string using JavaScript/JQuery

Example :

<html>
<body>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<textarea id="desc" rows="5" cols="50"></textarea>
<p id="charCount"></p>
   
 <script type="text/javascript">
   
   $(document).ready(function(){

        $('#desc').keyup(function(){
          var descStr = $('#desc').val();
          $('#charCount').text('Char Count: '+descStr.length);          
        });
       
      });
	  
</script>

</body>
</html>

Output :

Output :