www.wd4e.com

Trying to Create and Debug Your Own Output

In the previous lecture I showed you how you can create output using JavaScript. My code examples are all on CodePen and I have included a link to each of the examples in the Resources section of that video. With CodePen you get your own copy of my code that you can change. I encourage you to experiment with that code, or even better try recreating it yourself using an editor such as TextEdit, Sublime, or Notepad++.


If you are using a laptop or desktop to do your coding, make sure to use the console window of your browser to look for errors in your code. In programming, looking for and correcting errors is called "debugging." Below I have a screen shot of my code, the (empty) browser, and the error message I get from the Chrome console. Don't worry if error message itself doesn't make sense, that is something that comes with time, the important part is to look for the line number, in this case line 9. The console will always try to tell you about where it ran into a problem. In this case, I didn't include the quotes to end the message for the alert.