课程: JavaScript Practice: String Manipulation

Solution: Display a page heading in uppercase - JavaScript教程

课程: JavaScript Practice: String Manipulation

Solution: Display a page heading in uppercase

- [Instructor] In this challenge, we're building a website and our design colleagues would like us to make sure that one of the page headings is displayed in all uppercase letters. In my experience, this is a common situation to use the string method toUpperCase. You may notice that there are a lot of parallels between toUpperCase and toLowerCase. So let's go ahead and get started on this challenge because I have a feeling that you may get this one pretty quickly. So on line 10, we have the function transformPageHeading and we're going to get started on line 12 with our return statement and then heading. Here, to use toUpperCase, we just need to apply the string method toUpperCase, Similarly to toLowerCase, we want to make sure that toUpperCase is in camel case. It also does not take any arguments, so let's go ahead and run this one, and excellent. You can see MY SUPER COOL WEBSITE in all caps, amazing work.

内容