Advanced freeCodeCamp • top-learn-data-types-and-conditionals

Learn Data Types and Conditionals Lesson E

Lesson Overview

Strings defined using backticks are called template literals. They are a new way to define strings in JavaScript. They allow you to embed expressions within the string. This is done by wrapping the...

Strings defined using backticks are called template literals. They are a new way to define strings in JavaScript. They allow you to embed expressions within the string. This is done by wrapping the expression in ${}.

For example, the following code:

let name = "John";
let age = 25;
let greeting = `Hello, my name is ${name} and I am ${age} years old.`;

will result in the greeting variable containing the string “Hello, my name is John and I am 25 years old.”