Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
template literals
// The plain old way:
'<div class="' + className + '">' +
'<p>' + content + '</p>' +
'<a href="' + link + '">Let\'s go</a>'
// With ECMAScript 6:
<div class="${className}">
<a href="${link}">Let's go</a>
Your string can span multiple lines.
You don't have to escape quotation characters.
You can avoid groupings like: '">'
You don't have to use the plus operato
let nuts = 7
more.innerHTML = `
<h2>You collected ${nuts} nuts so far!
Double it, get ${nuts + nuts} nuts!!
<div id="more"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.