+ 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
9 Réponses
+ 3
var a_string = "aBcDeFgH";
var len = a_string.length;
console.log(len);
/* 8 */
https://code.sololearn.com/W3QUciHWd42e/?ref=app
+ 2
Use the length method of strings:
"word".length
+ 1
Thank you for replying.
+ 1
Thank for replying
0
Please help
0
To find out how many words do:
let txt = prompt();
let split = txt.split(“ “);
console.log(split.length);
0
And to count how mant charcters do:
let txt = prompt();
console.log(txt.length);
0
Thanks for replying
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