Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Template Strings | Section
JavaScript Essentials for Backend

bookTemplate Strings

Stryg for at vise menuen

Template strings allow you to create dynamic text by inserting variables directly into a string.

They use backticks instead of quotes:

123
const name = "John"; console.log(`Hello ${name}`);
copy

The ${} syntax lets you embed values inside the string.

You can also include expressions:

1234
const a = 2; const b = 3; console.log(`Sum is ${a + b}`);
copy

This makes strings easier to read and write compared to using + for concatenation.

Template strings are commonly used when building messages, responses, or working with dynamic data.

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 9

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Sektion 1. Kapitel 9
some-alt