# Template literals do not work

**URL:** <https://discourse.nodered.org/t/template-literals-do-not-work/37441>\
**Category:** General\
**Created:** [13 December 2020 10:30 UTC](https://discourse.nodered.org/t/template-literals-do-not-work/37441 "2020-12-13T10:30:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meng](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@Meng](https://discourse.nodered.org/u/Meng)\
**Post date:** [13 December 2020 10:30 UTC](https://discourse.nodered.org/t/template-literals-do-not-work/37441/1 "2020-12-13T10:30:01Z")

</div>

Hi all,  
I want to clean my code a bit and came by some advise to use template literals substitutions instead of string concatenation to make the code more readible. When i try this the results just shows the literals instead of the number. I am using NR 1.0.3, Nodejs v12.13.1 en Javscript V8 7.7.299.13-node.16.

> const lit=11;  
> msg.payload='template literals test ${lit}';

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [13 December 2020 10:33 UTC](https://discourse.nodered.org/t/template-literals-do-not-work/37441/2 "2020-12-13T10:33:46Z")

</div>

You need to use backticks not single quotes

```auto
msg.payload=`template literals test ${lit}`;

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 December 2020 10:33 UTC](https://discourse.nodered.org/t/template-literals-do-not-work/37441/3 "2020-12-27T10:33:50Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
