string.length : length « String « JavaScript Tutorial






The length property of an instance of the String object returns the total length of the string.

<html>
    <script language="JavaScript">
    <!--
    var myString1 = new String("Hello, World");

    var myString2 = new String("Here is a longer string");

    var myString3 = new String("Here is an even longer string");

    document.write(myString1 + ": is " + myString1.length);
    document.write(" characters long.<br>");
    document.write(myString2 + ": is " + myString2.length);
    document.write(" characters long.<br>");
    document.write(myString3 + ": is " + myString3.length);
    document.write(" characters long.<br>");
    document.close();
    -->

    </script>
</html>








6.19.length
6.19.1.string.length
6.19.2.Get the lengh of a string