javascript program with a flowchart to find the length of a string with form values entered by the user

javascript program with a flowchart to find the length of a string with form values entered by the user

In this tutorial, we will try to learn the followings;

  1. Flowchart to find the length of a string.
  2. javascript program to find the length of a string.
  3. javascript program to find the length of a string with form values entered by the user.

Flowchart to find the length of a string.

length of a number program in Javascript JS with flowchart
length of a number program in Javascript JS with flowchart

javascript program to find the length of a string.

<html>
<body>
<button onclick="my()">click me</button>
<p id="d"></p>
<script>
function my()
{
var str="PAKISTAN";
var a=str.length;
document.getElementById("d").innerHTML=a;
}
</script>
</body>
</html>

javascript program to find the length of a string with form values entered by the user.

<html>
<body>

<input id="num">

<button onclick="my()">click me</button>
<p id="d"></p>

<script>
function my()
{
var str;
str=document.getElementById("num").value;
var a=str.length;
document.getElementById("d").innerHTML=a;
}
</script>
<H5>www.sitebay.com/cpp-program/cpp-SHOW THE LENGTH OF STRING</H5>
</body>
</html>

Topic Covered

javascript program to find the length of a string. 
 
List of All Programs of Javascript : Click Here 
.

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.