This course has been updated! We now recommend you take the Complete Intro to Web Development, v2 course.

Check out a free preview of the full Introduction to Web Development course:
The "Exercise 4: Seeing Results" Lesson is part of the full, Introduction to Web Development course featured in this preview video. Here's what you'd learn in this lesson:

Nina walks through a short exercise demonstrating ways to see output from JavaScript in the browser. She also discusses how to handle users who do not have JavaScript enabled.

Get Unlimited Access Now

Transcript from the "Exercise 4: Seeing Results" Lesson

[00:00:00]
>> [MUSIC]

[00:00:03]
>> Nina Zakharenko: So I have my JavaScript here. I have three different kinds of statements that will help put results and they're all commented out. So we can un-comment them one by one. Let's see what happens. So when I run this code, I get a super annoying dialog box when I uncomment this out.

[00:00:28] And if you don't want that dialog box popping up every time you can put that comment back in front of it. This will write directly to the HTML page.
>> Nina Zakharenko: And this will log to the console. As you see though, nothing happened, and that's because we don't have our console open.

[00:00:52] So if we go to view, Developer, and the JavaScript console, we'll see our output right here.
>> Student 1: Nina, Eduardo is wondering your opinion about having to deal with JavaScript being disabled and developing a non-JavaScript version.
>> Nina Zakharenko: It's always a risk. But my thought on it is unless you're writing code for corporate use, in that case you know Java script is going to be disabled ahead of time.

[00:01:31] If your code's just out there, it's like, if a person chooses to have Java script off that's their choice, there's really not much you can do about it. There are some mobile browsers that might not be able to parse it and if those are your users, you should try to take care of them.

[00:01:54]
>> Student 2: I'll say that at Reddit we do not have a non JavaScript version of the site. We assume that our users have JavaScript because we've looked at our analytics and much over 90% of them, in fact, closer to 97% of our users have JavaScript enabled.
>> Nina Zakharenko: If you don't, you might be using an ancient computer that might not be able to parse the site anyway, or you're doing as choice, in which case...

[00:02:25]
>> Student 2: Some of the browser manufacturers are even talking about just removing the ability to disable JavaScript.
>> Nina Zakharenko: Yeah.
>> Nina Zakharenko: So does everyone see that hello console down here? Okay, for several of the future exercises we're gonna be using this console to, let's see,