0
0

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 1 year has passed since last update.

【Javascript】文字列の結合をテンプレートリテラル で実現する方法

Posted at

#テンプレート文字列とは
1.「+」の演算子を記述せずに、文字列の結合ができる
2.\nを記述しなくても複数行の出力ができる

以下では、標題の通り、文字列の結合に焦点を当てて話を進めていきます。

##テンプレート文字列を使用しない場合

const str1 = 'アメリカ';
const str2 = '合衆国';
console.log(`僕は${str1}${str2}出身です`);// ->僕はアメリカ合衆国出身です

上記の通り、${変数名}を記述すれば「+」演算子の記述が不要になる。

0
0
1

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?