Table of Contents

Code for Chapter 3: Working with Developer Tools:

To practice running JavaScript in the Developer Tools, open up Developer Tools on this page (F12 or right-click and select "Inspect Element"), then switch the the "Console." Paste the code below at the chevron (">"). What happened?

var liList = document.getElementById("table-of-contents").getElementsByTagName("li");
var liElements = liList.length;
alert('There are ' + liElements + ' exercises for this book');

Now try changing the alert() function to console.log(). How was this different than the first time you ran it?