How to use spaces in Template Literals?

bugsmasher

I have a <li> element showing dynamic content using Template Literals (template strings).

<li className='floatLeft'><span><b>Galley Details</b></span> <br/>{`${galleyCartsDet[0].quantity} Full Cart ${galleyCartsDet[1].quantity} Half Cart${galleyCartsDet[2].quantity} SMU${galleyCartsDet[3].quantity} Stowage`}</li>

How can I use spaces in the given template string?

`${galleyCartsDet[0].quantity} Full Cart ${galleyCartsDet[1].quantity} Half Cart${galleyCartsDet[2].quantity} SMU${galleyCartsDet[3].quantity} Stowage`
Ferris

You can use spaces in a template string in this way:

`\u00A0\u00A0${option.value}\u00A0\u00A0`

\u00A0 = non-breaking space
\u0020 = normal space

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to use template literals (``) within template literals?

How to use template literals for cms?

How to use template literals in require? (require(`${somePath}`))

How to use template literals in a constructor in JavaScript

How to use Template Literals in Cypress It() command description

How to use template literals in tailwindcss to change classes dynamically?

How can i use variable inside template literals?

How to use template literals queried from database or variable?

how to use es6 template literals with external html file

Use template literals for multiple classes

Avoiding the use of template literals in Javascript

Exclusive use of Template Literals in JavaScript?

How to lex/tokenise template literals

How to iterate through array of objects in template literals and use function for each of those objects?

How to use string literals in go

Can we use JS concat() inside Template literals (Template strings)?

How to render html inside Template literals?

Template literals: how to perform substitution correctly?

How do tagged template literals work in JavaScript?

How to implement blocks of template literals in the same module?

JS how to map through Array in template literals

`use strict` is not working when we use template literals

How to put spaces in blade template

How to display template literals inside template literal in HTML children property?

how to set the template & args in template literals at runtime in JavaScript

How to use spaces in "for" function

Why does Google use backticks or "template literals" in these NodeJS require functions?

How to use multiple string literals at once

nodejs: how to use literals in external require?