Template Strings
Sveip for å vise menyen
Template strings allow you to create dynamic text by inserting variables directly into a string.
They use backticks instead of quotes:
123const name = "John"; console.log(`Hello ${name}`);
The ${} syntax lets you embed values inside the string.
You can also include expressions:
1234const a = 2; const b = 3; console.log(`Sum is ${a + b}`);
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.
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 9
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Seksjon 1. Kapittel 9