JavaScript String length Property

Summary: In this tutorial you’ll learn how to use the .length property in JavaScript.

Definition and Usage

The length property returns the length of a string (number of characters).

The length of an empty string is 0.

Remember: Strings can be empty, a space or anything you can type on your keyboard.


var firstName = "Ada";
var myData = firstName.length;
// returns 3 cause the world Ada has 3 letters/strings in it

About the author

Leave a Reply

Your email address will not be published. Required fields are marked *