2

This looks like some sort of string.Format in JavaScript.

var some_var = "Alice",
    other_var = "Bob";
var test = `${"Hello " + some_var + ". How is " + other_var + "?"}`;
console.log(test);

What is it called? Browser compatibility?

Doubt from this question: How to pass properties to a variable function in javascript?

Community
  • 1
  • 1
naveen
  • 53,448
  • 46
  • 161
  • 251

2 Answers2

2

Those are called "Template Literals".

They're part of the ECMAScript 2015 Specification.

zzzzBov
  • 174,988
  • 54
  • 320
  • 367
2

It's a template literal: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

It's an ES6 feature that's now starting to get support in several js engines.

slebetman
  • 109,858
  • 19
  • 140
  • 171