Removing Whitespaces Using .trim() Method In JavaScript


#1

Hello,

It’s my second day of learning JavaScript and I’m trying to remove whitespaces in a string using the .trim() method but it does not seem to be working for me as I keep getting error messages. I’ll appreciate it if I’m pointed in the right direction.

Thank you.


#2

please see here:

Quick Tips for Writing Good Posts

what information you can provide so we can help you better. What is the error message? What is the code you attempted? And so forth, and preferable also the exercise url for quick access to the lesson


#3

Hi!

Thanks for responding to my question. I was going through my Introduction to JavaScript lesson and was trying to answer this question. Here’s the question below. I didn’t copy the error message.

Use the JavaScript documentation to find a string method that trims the whitespace at the beginning and end of a string.

Use the method to remove the whitespace at the beginning and end of the following statement (also in app.js):

'    Remove whitespace   '

#4

I don’t see you implemented the trim method?