html template string literal javascript code example
Example: javascript template literals html
// Create our object
const person = {
name: 'TopCoder2021',
job: 'Software Developer,
city: 'Los Angeles',
bio: 'Tony is a really cool guy that loves to code!'
}
// And then create our markup:
const markup = `
<div class="person">
<h2>
${person.name}
</h2>
<p class="location">${person.city}</p>
<p class="bio">${person.bio}</p>
</div>
`;
document.body.innerHTML = markup