From 5d9cc850532b2d0cddefddc29820ad5214f2b5d6 Mon Sep 17 00:00:00 2001 From: "Tsung Han (Jake) Yang" Date: Fri, 8 Jan 2016 09:11:16 -0800 Subject: [PATCH 1/6] Update README.md --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index b07fdc0c..f5c311ac 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,33 @@ To get updates, watch the repo and follow the [Twitter account](https://twitter # Tips list +## #09 - Template Strings + +As of ES6, JS now has template string as an alternative to classic end quotes strings. + +Ex: +Normal string +``` +var firstName = 'Jake'; +var lastName = 'Rawr'; +console.log('My name is ' + firstName + ' ' + lastName); +// My name is Jake Rawr +``` +Template String +``` +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. +(see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings) for example usage 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) From 95fe4addf640fea07ea03ab8bb298692bd08a05a Mon Sep 17 00:00:00 2001 From: "Tsung Han (Jake) Yang" Date: Fri, 8 Jan 2016 09:12:06 -0800 Subject: [PATCH 2/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5c311ac..d19532b7 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ To get updates, watch the repo and follow the [Twitter account](https://twitter ## #09 - Template Strings -As of ES6, JS now has template string as an alternative to classic end quotes strings. +As of ES6, JS now has template strings as an alternative to the classic end quotes strings. Ex: Normal string From 7718759e6b7eee0d645b8b611e2e696b2c7beef0 Mon Sep 17 00:00:00 2001 From: "Tsung Han (Jake) Yang" Date: Fri, 8 Jan 2016 09:12:46 -0800 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d19532b7..a79cb559 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ console.log(`My name is ${firstName} ${lastName}`); 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. -(see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings) for example usage of tagged template strings. +(see 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 From 8babc2ccea8da80c59f57d66f04cfa08a36aa6b2 Mon Sep 17 00:00:00 2001 From: "Tsung Han (Jake) Yang" Date: Fri, 8 Jan 2016 10:27:22 -0800 Subject: [PATCH 4/6] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a79cb559..6d0d7dca 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ To get updates, watch the repo and follow the [Twitter account](https://twitter ## #09 - Template Strings +> 2016-01-09 by [@JakeRawr] + As of ES6, JS now has template strings as an alternative to the classic end quotes strings. Ex: From 2e3d79798ff99e990dffe651aeb1fa1814214ef4 Mon Sep 17 00:00:00 2001 From: "Tsung Han (Jake) Yang" Date: Fri, 8 Jan 2016 10:28:27 -0800 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d0d7dca..aa407447 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ To get updates, watch the repo and follow the [Twitter account](https://twitter ## #09 - Template Strings -> 2016-01-09 by [@JakeRawr] +> 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. From c5407e19a27d5185a9844dca63311beeca918b5d Mon Sep 17 00:00:00 2001 From: "Tsung Han (Jake) Yang" Date: Sat, 9 Jan 2016 11:34:17 -0800 Subject: [PATCH 6/6] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aa407447..003acb04 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,14 @@ As of ES6, JS now has template strings as an alternative to the classic end quot 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}`); @@ -42,10 +42,10 @@ console.log(`My name is ${firstName} ${lastName}`); 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. -(see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/template_strings) for example usages of tagged template strings. +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 +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