1

When I am using

console.log("driving ${params.car} at the speed of ${params.speed}");

It is giving me result in terminal as

driving ${params.car} at the speed of ${params.speed}

Why isn't it printing the values?

2 Answers2

2

Just use (`) instead of (') or (").

Note that it is a backtick, not a quote.

Deepak Tatyaji Ahire
  • 4,241
  • 2
  • 9
  • 27
1

You have to use backquotes around the string in order for string interpolation to work.

console.log(`driving ${params.car} at the speed of ${params.speed}`);
Mark Bessey
  • 19,321
  • 4
  • 46
  • 67