Skip to content

Instantly share code, notes, and snippets.

@lricoy
Created March 23, 2016 01:51
Show Gist options
  • Save lricoy/d78961e4fe4c27957e39 to your computer and use it in GitHub Desktop.
Save lricoy/d78961e4fe4c27957e39 to your computer and use it in GitHub Desktop.
ES2015 Template String
// Criação de string literal básica (Basic literal string creation)
// Reparem que não é apóstofre (aspas simples) ou aspas, mas o ascento grave (`)
`This is a pretty little template string.`
// String de linhas múltiplas (Multiline strings)
`In ES5 this is
not legal.`
// Interpolação de variáveis (Interpolate variable bindings)
// Muito parecido com string.format do python
var name = "Bob", time = "today";
`Hello ${name}, how are you ${time}?`
// Unescaped template strings
String.raw`In ES5 "\n" is a line-feed.`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment