Template literals do not work

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}';

You need to use backticks not single quotes

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

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