Skip to content

Instantly share code, notes, and snippets.

@paigen11
Last active September 15, 2019 00:04
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/5a66a5d06d1f1b69bbe1b8d04b93a040 to your computer and use it in GitHub Desktop.
Save paigen11/5a66a5d06d1f1b69bbe1b8d04b93a040 to your computer and use it in GitHub Desktop.
The old way of injecting expression values into strings in JavaScript
const c = 10;
const d = 5;
console.log('It used to be harder to calculate that ' + (c + d)
+ '\n is not the same as ' + (2 * c) + ' in a string.');
/* prints: It used to be harder to calculate that 15
is not the same as 20 in a string. */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment