Skip to content

Commit

Permalink
Merge pull request loverajoel#52 from JakeRawr/master
Browse files Browse the repository at this point in the history
loverajoel#9 Template strings
  • Loading branch information
loverajoel committed Jan 9, 2016
2 parents 35475e5 + c5407e1 commit 24e4241
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@ To get updates, watch the repo and follow the [Twitter account](https://twitter
# Tips list

## #09 - Template Strings

> 2016-01-09 by [@JakeRawr](https://github.com/JakeRawr)
As of ES6, JS now has template strings as an alternative to the classic end quotes strings.

Ex:
Normal string
```javascript
var firstName = 'Jake';
var lastName = 'Rawr';
console.log('My name is ' + firstName + ' ' + lastName);
// My name is Jake Rawr
```
Template String
```javascript
var firstName = 'Jake';
var lastName = 'Rawr';
console.log(`My name is ${firstName} ${lastName}`);
// My name is Jake Rawr
```

You can do Multi-line strings without `\n` and simple logic (ie 2+3) inside `${}` in Template String.

You are also able to to modify the output of template strings using a function; they are called [Tagged template strings]
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings) for example usages of tagged template strings.

You may also want to [read](https://hacks.mozilla.org/2015/05/es6-in-depth-template-strings-2) to understand template strings more

## #08 - Converting a Node List to an Array

> 2016-01-08 by [@Tevko](https://twitter.com/tevko)
Expand Down

0 comments on commit 24e4241

Please sign in to comment.