课程: JavaScript Essential Training

今天就学习课程吧!

今天就开通帐号,24,600 门业界名师课程任您挑!

Traditional string output

Traditional string output

- [Instructor] Template Literals are great for outputting HTML and other content mixed with JavaScript. However, this is a very new technology and chances are, you'll come across existing code and tutorials where Template Literals are never used, instead you'll see standard strings used. This is the classic way of outputting string content using plain old strings. It's a bit more convoluted, but it is and will be used. So it's worth knowing about. To show you this, I need to simplify my example, otherwise we'll just end up with way too much code. So I'm going to delete the entire Template Literal. And instead set content equal to a string that holds an h1 and name goes here, and then closes the h1. If I save this, we'll just get an h1 saying name goes here on the browser, because we are still doing the same thing we're still taking the value of this, injecting it into the inner HTML of the body and the document.…

内容