How do you count the number of words in a string?

Word

1 answer

Answer

1168367

2026-08-01 22:45

+ Follow

To find the length of the string we use length method. The length property returns the length of a string (number of characters we use).The length of an empty string is 0.

For example:

function myFunction() {

var str = "Hello World!";

var n = str.length;

Hope this hepls.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.