Front-End/reactjs/chapter01/template_strings.js

16 lines
434 B
JavaScript

const title = "Best reads of 2019";
const author = "Mario";
const likes = 10;
// let result = "The blog called " + title + " by " + author + " has " + likes + " likes";
// Mit der Template-strings
let result = `The blog called ${title} by ${author} has ${likes} likes`;
let html = `
<h1>${title}</h1>
<p>By ${author}</p>
<span>The blog has ${likes} likes</span>
`;
console.log(result);
console.log(html);