Skip to content
Advertisement

Using len for text but discarding spaces in the count

So, I am trying to create a program which counts the number of characters in a string which the user inputs, but I want to discard any spaces that the user enters.

JavaScript

Using this, I can get the number of the characters in each word, without spaces, but I don’t know how to add each number together and print the total.

Advertisement

Answer

Count the length and subtract the number of spaces:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement