How to find string length in JavaScript

{0 Comments}

To find the length of a string a JavaScript inbuilt function will help you that itself named as ‘length’ this will return the number of character in the string. Following is the syntax to understand how you can use this.

 Javascript |  copy code |? 
1
<script type="text/javascript">
2
var someval = "it is a sample string";
3
 
4
var lengthofstring = someval.length;
5
 
6
document.write(lengthofstring);
7
 
8

Leave a Comment

Your email address will not be published.