How To Use String Length In JavaScript
  Home
 

This tutorial is based on examples to be easier to follow. In JavaScript the Length method is used to get the amount of characters in text. JavaScript length does not have any input parameters and the method is applied to JavaScript variable. The syntax of JavaScript String Length is:

<string_variable>.length;

In this JavaScript Tutorial example we will declare string variable named my_text and we are assigning to it value “JavaScript Online Course“. The all string contains 24 letters and the JavaScript Length returns the same number, see the example below.

<html>
  <body>
    <h2>My JavaScript String Length Example</h2>

    <script type="text/javascript">

      var my_text = "JavaScript Online Course";
      document.write("<p>The length is "+my_text.length+"</p>");

     </script>

    </body>
</html>

online tech support computer help computer technician computer problems javascript classes javascript string length javascript length in javascript string length in javascript courses online javascript online course retirement planning retirement

You can try this example on this link.

See Also:
Home


 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*