Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

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?

勉強ログ JavaScript

Last updated at Posted at 2025-04-22

String型の理解

テンプレートリテラル
文字列を書く方法

文字列をバッククォートで囲む。
${}の中に変数を入れると、その値を文字列中に埋め込むことが出来る、
${変数}

let menu = "蕎麦";
let str = 注文は${menu}です。;
console.log(str);
//注文は蕎麦です。

メモ:テンプレートリテラル内は、そのまま改行を入れられる。

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
ka0723na

@ka0723na

業界未経験2年目のコーダーです。 勉強ログを毎日残していければと思っています。

Comments

ffgogfb454
@ffgogfb454

${}の中に変数を入れると、その値を文字列中に埋め込むことが出来る、

変数に限らず、値が返るものなら大抵OKです。

console.log(`${"abc"}`); // "abc"
console.log(`${123}`); // "123"
console.log(`${[1,2,3]}`); // "1,2,3"
console.log(`${new Date()}`); // "Tue Apr 22 2025 01:07:59 GMT+0900 (日本標準時)"
console.log(`${Math.random()}`); // "0.5329216256846055"
0

Let's comment your feelings that are more than good

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details

Being held Article posting campaign

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?

Login to continue?

Login or Sign up with social account

Login or Sign up with your email address