Categories
JavaScript Answers

How to create string with multiple spaces in JavaScript?

Spread the love

Sometimes, we want to create string with multiple spaces in JavaScript.

In this article, we’ll look at how to create string with multiple spaces in JavaScript.

How to create string with multiple spaces in JavaScript?

To create string with multiple spaces in JavaScript, we use &nbsp.

For instance, we write

const str = "hello" + "&nbsp &nbsp &nbsp &nbsp &nbsp" + "world";

to add 5 spaces to the str string with "&nbsp &nbsp &nbsp &nbsp &nbsp".

Conclusion

To create string with multiple spaces in JavaScript, we use &nbsp.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.