+ 2

How to find length of word in javascript?

That means how many letters are used in a word.using javascript.if there is any code please reply it

13th Apr 2022, 5:07 PM
Aswin
Aswin - avatar
9 Respostas
+ 3
var a_string = "aBcDeFgH"; var len = a_string.length; console.log(len); /* 8 */ https://code.sololearn.com/W3QUciHWd42e/?ref=app
13th Apr 2022, 5:52 PM
BroFar
BroFar - avatar
+ 2
Use the length method of strings: "word".length
13th Apr 2022, 5:09 PM
Lisa
Lisa - avatar
+ 1
Thank you for replying.
14th Apr 2022, 2:02 AM
Aswin
Aswin - avatar
+ 1
Thank for replying
16th Apr 2022, 3:19 AM
Aswin
Aswin - avatar
0
Please help
13th Apr 2022, 5:08 PM
Aswin
Aswin - avatar
0
To find out how many words do: let txt = prompt(); let split = txt.split(“ “); console.log(split.length);
15th Apr 2022, 2:24 AM
Junior
Junior - avatar
0
And to count how mant charcters do: let txt = prompt(); console.log(txt.length);
15th Apr 2022, 2:27 AM
Junior
Junior - avatar
0
Thanks for replying
15th Apr 2022, 9:29 AM
Aswin
Aswin - avatar
0
Use .length after the variable saving the string For example: var randomWord = prompt(); console log(randomWord.length); The above code will collect the word as an input and print to the console the number of letters in the word
15th Apr 2022, 1:36 PM
Olufikayomi Jetawo