Answer the question
In order to leave comments, you need to log in
How to remove all extra spaces, js?
Good afternoon! Can you please tell me how to remove all extra spaces?
For example, there is a line
const str = ' some string and something '
const str = 'some string and something'
const reg = /(^\s+|\s+$)|\s\s+/g;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question