

Press the arrow keys to highlight document on the dropdown menu. To try autocompletion while writing multi-part expressions: This feature is a great way to learn about JavaScript methods that you didn't know of before. The Console helps you write complex JavaScript using autocompletion.

When you press Enter, the Console runs the JavaScript command (expression or statement), displays the result, and then moves the cursor down to allow you to enter the next JavaScript command.Īutocompletion to write complex expressions The Console displays the result while you type, regardless of whether your JavaScript is correct, and regardless of whether a valid result exists. The Eager evaluation feature helps you write valid JavaScript. The Console immediately displays the result 4 on the next line while you type. If necessary, click in DevTools to give it focus, and then press Esc to open the Console.Ĭlick in the Console, and then type 2+2, without pressing Enter. Or, press Ctrl+Shift+J (Windows, Linux) or Command+Option+J (macOS), to directly open the DevTools console. Right-click in a webpage and then select Inspect. To enter JavaScript statements and expressions interactively in the Console:
