Skip to content

Instantly share code, notes, and snippets.

@michaelschofield
Created September 11, 2015 14:43
Show Gist options
  • Save michaelschofield/971bfdb9a88f33ccbd82 to your computer and use it in GitHub Desktop.
Save michaelschofield/971bfdb9a88f33ccbd82 to your computer and use it in GitHub Desktop.
ES6 Template String

ES6 Template String

Template strings let you create strings using backticks and a ${object} syntax, which is pretty familiar, to let you swap variables into strings less painfully.

A Pen by Michael Schofield on CodePen.

License.

var me = {
name : 'Michael',
age : '29',
eyes : 'blue'
}
document.write( `Hi, I'm ${me.name}! I'm ${me.age} and my eyes are ${me.eyes}.` );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment