DEV Community

Grace Do
Grace Do

Posted on

String interpolation

In JavaScript, string interpolation must be enclosed in the backticks:

`The count is ${num}`
Enter fullscreen mode Exit fullscreen mode

In Ruby, string interpolation is written as a normal string, with single or double quotes:

"The count is #{num}"
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
heratyian profile image
Ian

Hi Grace. Good insight. In Ruby, I believe you have to use double quotes for string interpolation.