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?

Avishek Sinha
  • 17
  • 1
  • 7

2 Answers2

2

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

Note that it is a backtick, not a quote.

Deepak Tatyaji Ahire
  • 4,883
  • 2
  • 13
  • 35
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,598
  • 4
  • 47
  • 69