JavaScript program to find length of a string


Following program shows you how to find length of a string.
In this program we get string from user and prints the length using .length

var input = prompt("Please enter the string:");
var lengthOfString  = input.length;
console.log("Length of the given string is: " + lengthOfString);

Output:

Please enter the string:
hello
Length of the given string is: 5