How TO - Get The Length of a String


Learn how to find the length of a string in JavaScript.


String Length

The length property returns the length of a string:

Example

var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var len = txt.length;
Try it Yourself »

Read more about strings in our JavaScript Strings Tutorial.

Read more about the length property in our JavaScript String length Reference.


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.