0
Extra characters and words
How do I make it so it doesnât count spaces? Like when I say âI eat applesâ itâll come out as 12 even tho itâs ten letters https://code.sololearn.com/WNRqiPnw25yD/?ref=app
7 RĂ©ponses
+ 1
In a string white space are characters as well. Spaces, tabs, ect. This I eat apples is twelve in length.
0
How do i fix that? William Owens
0
It didnt work Jay Matthews
0
Can you show me where it goes in the code?
0
But what about my length? Where does that go?
0
Okay, what if i wanted to do that in python now?
https://code.sololearn.com/cCQAfpI7a7UV/?ref=app
0
Alternatively, you can also use array functions
const letterCount = str => Array.from( str ).filter( c => c != ' ' ).length;
console.log( letterCount( "I eat apples" ) );