1 00:00:00,540 --> 00:00:03,580 You've learned what JavaScript is, where it runs, and 2 00:00:03,580 --> 00:00:05,740 how to use some of its built-in commands. 3 00:00:05,740 --> 00:00:10,040 You've written JavaScript in the console, even created and linked a JavaScript file. 4 00:00:10,040 --> 00:00:12,890 Now, you're going to work on a practice exercise on your own, 5 00:00:12,890 --> 00:00:14,250 a challenge of sorts. 6 00:00:14,250 --> 00:00:17,450 You'll do this periodically throughout the course to give you opportunities to 7 00:00:17,450 --> 00:00:20,030 practice and help make what you've learned sink in. 8 00:00:20,030 --> 00:00:21,160 Let's go over what you'll need to do. 9 00:00:22,980 --> 00:00:27,317 You're going to practice using JavaScript by writing a self-destructing message 10 00:00:27,317 --> 00:00:27,840 program. 11 00:00:27,840 --> 00:00:30,790 The page will display a message with an alert 12 00:00:30,790 --> 00:00:33,757 dialog warning us that the message will self-destruct, 13 00:00:33,757 --> 00:00:39,650 then it displays the series of alerts that count down from three, to two, to one. 14 00:00:39,650 --> 00:00:44,548 After that, the message on the page gets replaced by the text, boom, and 15 00:00:44,548 --> 00:00:45,974 Message destroyed! 16 00:00:45,974 --> 00:00:47,750 Appears in the console. 17 00:00:47,750 --> 00:00:50,690 Launch the workspace with this video to access the starter files for 18 00:00:50,690 --> 00:00:51,970 this challenge. 19 00:00:51,970 --> 00:00:56,920 In the file script.js, you'll find the instructions for this practice challenge. 20 00:00:56,920 --> 00:01:00,700 The lines with the two backslashes in front of the text are JavaScript 21 00:01:00,700 --> 00:01:03,710 comments, and you'll learn more about writing comments in a later video. 22 00:01:03,710 --> 00:01:08,483 For now, just know that any characters immediately following the two backslashes 23 00:01:08,483 --> 00:01:12,108 until the end of the line are ignored by the JavaScript engine. 24 00:01:12,108 --> 00:01:16,080 You're going to use much of what you've learned so far to write this program. 25 00:01:16,080 --> 00:01:18,240 So let's go over the instructions. 26 00:01:18,240 --> 00:01:23,080 First, you'll need to display an alert dialog with the content, Warning! 27 00:01:23,080 --> 00:01:26,650 This message will self-destruct in. 28 00:01:26,650 --> 00:01:28,655 Then, display a 3... 29 00:01:28,655 --> 00:01:29,282 2... 30 00:01:29,282 --> 00:01:29,803 1... 31 00:01:29,803 --> 00:01:34,445 Countdown, as shown in the demo, using alert dialog boxes. 32 00:01:37,548 --> 00:01:41,270 I have provided the line of JavaScript to help you complete the next step. 33 00:01:41,270 --> 00:01:45,740 You don't need to change this code or worry about what any of it means for now. 34 00:01:45,740 --> 00:01:50,580 As the comment says, this statements selects the <h1> element 35 00:01:50,580 --> 00:01:55,480 on the page and replaces its text with BOOM! 36 00:01:55,480 --> 00:01:58,090 Soon, you'll be a pro at working with JavaScript code like this, but 37 00:01:58,090 --> 00:01:59,990 don't worry about it for now. 38 00:01:59,990 --> 00:02:04,767 Finally, after the message self destructs, where it gets replaced with the text BOOM! 39 00:02:04,767 --> 00:02:08,710 You'll need to display the text, Message destroyed! 40 00:02:08,710 --> 00:02:10,010 In the console. 41 00:02:10,010 --> 00:02:14,289 I've already linked the script.js file to index.html. 42 00:02:14,289 --> 00:02:18,259 And feel free to customize the initial message displayed between the h1 43 00:02:18,259 --> 00:02:19,740 heading tags. 44 00:02:19,740 --> 00:02:22,000 As you work through this practice challenge, 45 00:02:22,000 --> 00:02:25,600 keep in mind that you're not expected to remember everything right away. 46 00:02:25,600 --> 00:02:29,801 You can refer to any notes you've taken, code that you've written so far, or 47 00:02:29,801 --> 00:02:31,275 go back and review a video. 48 00:02:31,275 --> 00:02:35,110 This challenge is a great way to practice what you've learned so far. 49 00:02:35,110 --> 00:02:36,630 So good luck, have fun. 50 00:02:36,630 --> 00:02:38,780 And in the next video, I'll show you my solution.