Monday, May 13, 2024
147
rated 0 times [  152] [ 5]  / answers: 1 / hits: 19573  / 9 Years ago, tue, october 27, 2015, 12:00:00

I have a string template that currently looks like this:



var option = u00A0 + u00A0 + u00A0 + u00A0 + option.name;


that I am trying to change to the new ES6 syntax



var option = `    ${option.name}`


But when it shows up in on screen none of the spaces are in the ES6 version or there is no 4 space indention on the strings in which I am specifying it. The problem might have something to do with me using these strings in as options in a select. Any ideas?


More From » ecmascript-6

 Answers
8

In the first example you are using a non-breaking space (u00A0) and in the second example a normal space (u0020). So in addition to changing the syntax, you also changed the characters.



This doesn't really have anything to do with ES6 in particular. If you use the same character it will work as expected:



var option = `u00A0u00A0u00A0u00A0${option.name}`;

[#64584] Saturday, October 24, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kylanalis

Total Points: 438
Total Questions: 85
Total Answers: 102

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
kylanalis questions
Sat, Oct 2, 21, 00:00, 3 Years ago
Tue, Oct 13, 20, 00:00, 4 Years ago
Thu, Feb 13, 20, 00:00, 4 Years ago
Tue, Jan 7, 20, 00:00, 4 Years ago
;