Skip to content

Instantly share code, notes, and snippets.

@paigen11
Created September 15, 2019 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paigen11/b862e71a43cc8ae45661ccc3366a8a52 to your computer and use it in GitHub Desktop.
Save paigen11/b862e71a43cc8ae45661ccc3366a8a52 to your computer and use it in GitHub Desktop.
Template literal syntax using expression interpolation
const c = 10;
const d = 5;
console.log(`With the syntactic sugar of ES6 template literals,
doing math in strings like this: ${c + d}
and that: ${2 * c} is a cinch.`);
/* prints: With the syntactic sugar of ES6 template literals,
doing math in strings like this: 15
and that: 20 is a cinch. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment