1

According to this article, many ES6 functions (particularly template literals, formally known as 'template strings') are enabled by default.

The below was entered into the terminal:

user@host: node
> "test string: ${10+4}"
'test string: ${10+4}'

Even when using the '--harmony' flag, template literals are not being executed as code and are instead being treated like strings.

My version is as follows:

user@host: node -v
v5.7.0

Any suggestions would be greatly appreciated.

Andy
  • 221
  • 3
  • 12

1 Answers1

2

Template strings are surrounded by ` (back quote) character:

`test string: ${10+4}`
madox2
  • 49,493
  • 17
  • 99
  • 99
  • Are there any disadvantages to using the back quote? I'm assuming parsing the string must take some time. – Andy Mar 01 '16 at 17:32
  • see this question http://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation – madox2 Mar 01 '16 at 17:34