How do you launch the JavaScript debugger in Google Chrome?

How do you launch the JavaScript debugger in Google Chrome?

When using Google Chrome, I want to debug some JavaScript code. How can I do that?

Solutions/Answers:

Solution 1:

Windows: CTRLSHIFTJ OR F12

Mac: J

Also available through the wrench menu (Tools > JavaScript Console):

JavaScript Console Menu

Solution 2:

Try adding this to your source:

debugger;

It works in most, if not all browsers. Just place it somewhere in your code, and it will act like a breakpoint.

Solution 3:

Windows and Linux:

Ctrl + Shift + I keys to open Developer Tools

Ctrl + Shift + J to open Developer Tools and bring focus to the Console.

Ctrl + Shift + C to toggle Inspect Element mode.

Mac:

+ + I keys to open Developer Tools

+ + J to open Developer Tools and bring focus to the Console.

+ + C to toggle Inspect Element mode.

Source

Other shortcuts

Solution 4:

Press the F12 function key in the Chrome browser to launch the JavaScript debugger and then click “Scripts”.

Choose the JavaScript file on top and place the breakpoint to the debugger for the JavaScript code.

Solution 5:

Ctrl + Shift + J opens Developer Tools.

Solution 6:

In Chrome 8.0.552 on a Mac, you can find this under menu View/Developer/JavaScript Console … or you can use Alt+CMD+J.