You can start coding JavaScript with just a modern web browser: open its developer tools, select the Console, and enter a small expression such as 2 + 3. The Console evaluates what you type and shows the result. From there, you can try console.log() to display values and, once you are comfortable, experiment with code that interacts with the page currently open.
What the JavaScript Console does
A browser’s developer-tools Console is an interactive place to enter JavaScript and see what it returns. Chrome describes it as a REPL—“Read, Evaluate, Print, and Loop”—because it reads an expression, evaluates it, prints a result, then waits for your next input. Chrome DevTools: Run JavaScript in the Console explains this workflow; MDN’s JavaScript introduction also describes using a browser console to enter and run code.
As an Amazon Associate I earn from qualifying purchases.
The Console is useful for learning and quick experiments. It is not the same as a full code editor or a saved JavaScript file: what you enter is evaluated in the browser session, and page-related code acts on the page that is currently loaded.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Open the Console
Open your browser’s developer tools and choose the Console tab. The exact menu labels and keyboard shortcuts depend on the browser and operating system. In Chrome, the documented shortcuts are Control+Shift+J on Windows, Linux, and ChromeOS, and Command+Option+J on macOS. If a shortcut does not work, open the browser’s developer-tools menu and select Console.
#1 Best Overall
Run your first JavaScript
Try an expression
Type this into the Console and press Enter:
2 + 3
The Console evaluates the expression and displays 5. You can try other simple expressions, such as 10 * 4 or "hello".toUpperCase(). The displayed result is the value produced by the expression.
Use console.log() to display a value
Now enter:
console.log("Hello, JavaScript!")
console.log() explicitly writes its argument to the Console. That differs from entering 2 + 3 by itself: the first example asks JavaScript to log a value, while the second is an expression whose result the interactive Console displays. MDN documents console.log() and other Console methods in its Console API reference.
Rank #2
Store and inspect a value
A variable gives a value a name. Enter these as two separate lines:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsconst name = "Ada";
console.log(name);
The first line declares a constant named name; the second logs its value. Try changing "Ada" to another name and running the lines again. Because name was declared with const, do not redeclare the same name in the same Console session; use a different variable name, or reload the page to start a fresh session.
Try code that interacts with the current page
In a browser Console, JavaScript can use page APIs such as document. For example, Chrome’s tutorial demonstrates changing the text of a button on the currently loaded page with code like this:
document.getElementById("my button").textContent = "New button text";
This only works if the current page contains an element whose id is exactly my button; otherwise, there is no matching button to update. The example changes the live page, not a permanent source file, so reloading the page may undo the change. Do not assume every website has a button with that ID—inspect or use a page you control before adapting the example.
Rank #4
When the result is unexpected
Read the first error message shown in the Console, then check the code around the reported location. A small typo can prevent a whole line from running. MDN recommends logging intermediate values as a debugging aid; MDN’s guide to finding what went wrong covers the browser’s debugging tools.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Check that names are spelled consistently and capitalization matches.
- Check that parentheses, quotation marks, and brackets are paired.
- Use
console.log(value)to see the value of an expression or variable while investigating. - For page code, confirm that the expected element exists on the current page and that its identifier matches exactly.
Browser Console or Node.js?
Both environments can run JavaScript and provide console-style output, but they do not run in the same context. A browser Console is tied to the current page; Node.js runs JavaScript in a Node process outside that page. The Node.js documentation describes its own Console API; that versioned reference should not be taken to describe every Node release identically.
Best Value
| What differs | Browser DevTools Console | Node.js |
|---|---|---|
| Execution context | The currently loaded browser page | A Node.js process, not the current browser page |
| Getting started | Available in a modern browser’s developer tools | Requires a Node.js runtime |
| APIs | Can access page and DOM APIs such as document, when available in that page context |
Provides Node-specific APIs; browser page objects such as document are not part of the Node Console context |
| Output context | Results and logged values appear alongside the page’s developer tools | Console output belongs to the Node process environment |
For a first expression or a quick console.log() example, the browser Console is a convenient place to begin. Node.js is a separate option when your goal is to run JavaScript outside a browser page.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




