top of page

Write a Program to Find the Length of the String in JavaScript.

Code:

<!DOCTYPE html>
<html>
<body>

<h2>Program to Find the length of the String </h2>

<p>Length of the String <b>"Welcome to The Tech Platform" </b> is :</p>

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

<script>
var txt = "Welcome to The Tech Platform";
var sln = txt.length;
document.getElementById("demo").innerHTML = sln;
</script>

</body>
</html>


Output:






Source: W3School


The Tech Platform

www.thetechplatform.com

0 comments
bottom of page