Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

How does variable.trim(); work?

Hello!

Near the end of Cloudrip Mountain, the levels want us to modify strings and count the number of “whitespaces”.
What are whitespaces and how does variable.trim() work?

Thank you in advance :smile: :heart:

I think I might have figured it out
White spaces are just spaces (" ") that are at the beginning or end of a message, not in between
It just deletes the white spaces and returns it
(dashes are white spaces in this example)
“- - - Hello there - -”
After trimming: “Hello there”