String Length in javascript

Something Like that:
length

For that you need to create first html code.

HTML

<p id="demo"></p>

After that add this JS code.

JS

var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var sln = txt.length;
document.getElementById("demo").innerHTML = sln;

[codepen_embed height=”265″ theme_id=”0″ slug_hash=”NvPmoY” default_tab=”js,result” user=”pradeepanvi”]See the Pen String Length in javascript by Pradeep Kumar (@pradeepanvi) on CodePen.[/codepen_embed]

Now you can see string length 26

Leave a Reply

Your email address will not be published. Required fields are marked *