Errors

For demonstration purposes, let’s create an error in the kittenbook code. Open the main.js file in the release directory and remove the closing parentheses on from the first line of the getUserName function. That first line should now look like this:

var userName = prompt('Hello, what\'s your name?';

Now open the Chrome Extensions page (chrome://extensions/) and reload the kittenbook extension; then load https://www.facebook.com/. Open the Chrome Developer Tools (the keyboard shortcut is Ctrl+Shift+I for Windows and Linux, and Cmd+Alt+I for Mac). In the Developer Tools, click the Console tab and look for red text. You should see something like Figure 12.6. If your JavaScript code has any errors, those errors ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.