I want to make a space remover code in javascript. | Sololearn: Learn to code for FREE!

+6

I want to make a space remover code in javascript.

If i add a some text in textarea. Like a How are you? What is this? My name is ashi. What are you doing? My new code. Its sololearn. And after click on submit button its show me all words like this without starting space. How are you? What is this? My name is ashi. What are you doing? My new code. Its sololearn.

11/29/2021 4:13:11 PM

Ayesha Noor

12 Answers

New Answer

+13

Here you go Ayesha Noor https://code.sololearn.com/WyezaMy7RK3N/?ref=app

+7

U can use: SomeString.replace(/ /g, "") to replace all space in a string

+7

In HTML all the white space are ignored by default. You can use <pre> tag if you want your text as it is.

+5

https://code.sololearn.com/WriblWLOScNK/?ref=app

+3

Ayesha Noor You haven't defined your onclick function yet. Submit button is useless without that.

+1

Please make a example

+1

Akaanksha, can you plzzz make a one exapmle ?

+1

Thanks so much.

+1

Aakaanksha 💕, can be written much simpler: .replace(/^\ +/gm,"")

+1

Ephraim Please create a new question, not in a discussion. And to answer your question, HTML is important because it's basically how every website works.

-5

यार मुझको यहाँ कुछ भी समझ नहीं आ रहा है। 😌😌😒😒😣😣😣😭😭😭😭

-5