Search code examples
javascriptstringconcatenationfrontend

Template String and Interpolation String in Javascript ES6 don't Working


Its appear be so simple use but its dont work in my Chrome Browser. Can someone help me?

That's my code:

var a = "Something";
Var b = "is";
console.log('${a} ${b} wrong.');

I did put this code in console in chrome browser but its dont worked how should work.


Solution

  • You need to use backtick.

    let a = "Something";
    let b = "is";
    console.log(`${a} ${b} wrong.`);