Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Template Literals #270

Merged
merged 1 commit into from
Dec 7, 2020
Merged

Conversation

p42-ai[bot]
Copy link
Contributor

@p42-ai p42-ai bot commented Dec 7, 2020

Template literals are string templates that can include variables and expressions. They can replace string concatenation and are often easier to read. Example: `Hello, ${name}!`

This refactoring supports converting the first line of concatenated strings into template literals or shortened strings:

  • concatenated string literals will be combined, e.g. "a" + "b" will become "ab"
  • concatenated expressions and variables will be embedded in templates, e.g. "a" + x + "b" will become `a${x}b`
  • unnecesary escaping of quotes is removed when string are combined or transformed into template literals

**Template literals are string templates that can include variables and expressions.** They can replace string concatenation and are often easier to read. Example: `` `Hello, ${name}!` ``

This refactoring supports converting the first line of concatenated strings into template literals or shortened strings:
* concatenated string literals will be combined, e.g. `"a" + "b"` will become `"ab"`
* concatenated expressions and variables will be embedded in templates, e.g. `"a" + x + "b"` will become `` `a${x}b` ``
* unnecesary escaping of quotes is removed when string are combined or transformed into template literals
@domoritz domoritz merged commit f337a1c into master Dec 7, 2020
@domoritz domoritz deleted the p42/es6_template_literals/1607353768750 branch December 7, 2020 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant