Template strings

- [Voiceover] In this video, I'm going to demonstrate…one of my favorite ES2015 features, template strings.…Template strings are an incredibly simple,…but surprisingly powerful, bit of syntactic sugar…to help you in those scenarios…when you want to construct a string…that includes the values of your variables.…Here's a really simple example.…The first thing to notice is the syntax.…In JavaScript, there are two ways…to define a string literal value.…You can wrap the text in single or double quotes.…

In order to define a string template,…you use the backtick symbol,…that one right next to your 1 key…that you've never used for anything else.…Inside the template, you can write whatever…string literal you want, just like a normal string literal,…except for when you want to inject a value.…That's when you open up an expression…by typing ${…You close the expression by closing the bracket.…Inside of those brackets, you can put…whatever JavaScript expression you like,…and the result will be rendered at that place in the string.…

Resume Transcript Auto-Scroll

Author

Released

5/2/2016

TypeScript lets you write JavaScript "the way you really want to." TypeScript compiles to plain JavaScript, so it works in any browser, any host, and any OS. It adds a variety of helpful syntax and tools onto an already mature language, bringing the power and productivity of static typing and object-oriented development to core JavaScript. Plus, it's completely open source.

In this course, Jess Chadwick teaches you how to leverage the full power of the TypeScript language in your JavaScript applications, starting by revisiting some JavaScript fundamentals. Then he reviews the data types, classes, generics, modules, and decorators that are unique to TypeScript. In the "Real-World Application Development" chapter, he demos how to convert an existing JavaScript codebase to take advantage of everything TypeScript has to offer. What's more, he shows you how to do it all using the environment of your choosing: Windows, Mac, or even Linux.