How to calculate le…
 
Notifications
Clear all

How to calculate length of a string in javascript?

2 Posts
3 Users
0 Likes
207 Views
0
Topic starter

How to calculate length of a string in javascript?

2 Answers
0

You can calculate the length of a string in JavaScript using the .length property. For example: 

const myString = "Hello, World!";
const length = myString.length;
// 'length' will be 13 in this case
0

The length of a string in JavaScript can be found using the . length property. Since . length is a property it must be called through an instance of a string class.

Share: