How to write JavaScript to clear a space in a string

Asked 2 years ago, Updated 2 years ago, 103 views

How do I clear a space in a string?

Input : '/var/www/site/Brand new document.docx'
Output : '/var/www/site/Brandnewdocument.docx'

I want this kind of result.

javascript jquery text

2022-09-22 22:07

1 Answers

str = str.replace(/\s+/g, '');' You can do it in this way. \s stands for blank.


2022-09-22 22:07

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.