What is JavaScript?
What JavaScript is, where it runs, and what Node.js has to do with it.
Step 1
The idea
Think of a website as a puppet show. There are three people involved:
- HTMLbuilds the puppet — the structure (head, arms, body).
- CSSdresses the puppet — colours, size, costume.
- JavaScriptis the puppeteer — makes it move, react, and do things when the audience interacts.
JavaScript (JS) is the programming language of the web. It runs inside browsers — but with Node.js, it also runs on your computer directly, outside any browser. That's how Playwright works: Node.js runs your test scripts on your machine.
Step 2
See it run
Here's the output first:
JavaScript is running on my computer!And the file that produces it:
console.log("JavaScript is running on my computer!");Run it with:
$ node intro.jsThat's Node.js reading your file and executing it. No browser needed.
Step 3
Now you try
Create a file called intro.js in your playwright-course folder, paste the code above, and run it.
Then change the message inside the quotes to anything you like and run it again.
Step 4
Why a tester cares
Node.js lets JavaScript do things beyond the browser — read files, make network requests, run scripts automatically. Here's a simple example: printing a personalised message using Node.js on your computer.
const name = "Priya";
const tool = "Node.js";
console.log(`Hello ${name}! You're running JavaScript with ${tool}.`);
console.log("No browser needed — just the terminal.");$ node greet.jsThis is exactly the kind of script automation engineers write — not web pages, but programs that run and do things. Playwright is just a much more powerful version of this idea.
Recap
- 1JavaScript is the language that makes web pages interactive — and Playwright tests are written in it.
- 2Node.js lets JavaScript run on your computer (not just in a browser).
- 3Every Playwright test is a .js (or .ts) file that Node.js executes.