4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

${} テンプレートリテラルとは

Last updated at Posted at 2019-12-03

${}テンプレートリテラルとは

ECMAScript 6 で新しく使えるようになった構文のひとつで、変数や式を組み込むための記号。

通常、文字列の中に変数を入れようとすると

xxx.js
var foo = 'ート';
var bar = 'テンプレ' + foo + 'リテラル';
xxx.js
var foo = 'ート';
var bar = `テンプレ${foo}リテラル`;
console.log(bar); // テンプレートリテラル

+演算子 を使わずに文字列を繋げていくことができます。
${~} の中には、式であれば何でも入れることができます!

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?