

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the length of a string in JavaScript?
To get the length of a string in JavaScript, use the length property. The length property returns the number of characters in a string.
Example
You can try to run the following code to learn how to get the length of a string
<html> <head> <title>JavaScript String length Property</title> </head> <body> <script> var str = new String( "Tutorialspoint Tutorials" ); document.write("Length of string:" + str.length); </script> </body> </html>
- Related Questions & Answers
- How to get the length of a string in Python?
- How to get the Length of a String in Java?
- How to get the length of a Number in JavaScript?
- How to get the length of longest string in a PHP array
- How to get the length of an object in JavaScript?
- Reversing the even length words of a string in JavaScript
- JavaScript get the length of select options(dropdown)?
- How to concatenate the string value length -1 in JavaScript.
- How to get the primitive value of string in Javascript?
- How to get a string representation of a number in JavaScript?
- How to get a number value of a string in Javascript?
- How do I get the average string length in MySQL?
- Length of longest string chain in JavaScript
- How to get a number of vowels in a string in JavaScript?
- How to get the maximum count of repeated letters in a string? JavaScript
Advertisements