Search This Blog

Sunday, 31 July 2016

How to find the string length using javascript?

Html page:

<p id="P7"></p>

Javascript page:

<script>
    var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    document.getElementById("demo").innerHTML = txt.length;
</script>

Output:

26

No comments:

Post a Comment