From the course: JavaScript: Enhancing the DOM

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Communicating with the console through JavaScript

Communicating with the console through JavaScript

From the course: JavaScript: Enhancing the DOM

Start my 1-month free trial

Communicating with the console through JavaScript

In the last movie, we saw how we can issue commands to HTML page from within the browsers console. In this movie, we're going to take a look at how to communicate with the console from within a JavaScript document. So I'm going to go to the HTML document for this page. And, at the very bottom, I'm going to add a script tag. And that script tag is going to call a document called myscript.js. Now, that document is inside an underscore folder and inside a JavaScript folder, and it's called myscript.js. So, I'll save this, and then I can close my index HTML document and work on the myscript.js file. In the early days of JavaScript, the most common way of debugging your software was through the alert message. It looks something like this and let me go ahead and save this. Switch back to my HTML page and just refresh the browser. You can see the alert comes right up. That really gets your attention. But it's not very useful. Especially if you're testing for things that happen often, like…

Contents