TIL15 - JS - String Interpolation

Peter D Lee·2020년 8월 26일
0

JavaScript

목록 보기
4/19

You can insert, or interpolate variable values into a string by using template literals

Syntax

  • A template literal is enlosed by ``, or backticks
    > note that this is different from the regular single quotation marks ''
  • *Inside the template literal, placeholders are used to insert variables
    > a placeholder is denoted by ${}

ex)

let myName = 'Peter';
console.log(`My name is ${myName}.`);
// Prints: My name is Peter.

0개의 댓글