Chapter 05: Operators and expressions
Automation learning lab
Playwright Automation
Self Study Guide
Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.
Operators and expressions
Operators calculate or compare values. Arithmetic operators include +, -, *, and /. Use === for strict equality without implicit conversion. Logical operators combine conditions; && requires both truthy operands and OR selects the first truthy operand.
How it works
Step-by-step walkthrough
- Calculate a total
- Compare with the target
- Print the boolean
Example
const price = 50;
const qty = 2;
console.log(price * qty);
console.log(price * qty === 100);Prefer strict equality to avoid surprising coercion.
✎ Your practice task
Try comparing 100 and '100' with ===.
Knowledge check
Which operator checks strict equality?
🌐 Continue learning
60-chapter learning path
Start at chapter 1, or choose any topic. Your progress is tracked separately for each chapter.
JavaScript fundamentals
TypeScript fundamentals
Playwright • setup & locators
Playwright • interactions & assertions
Playwright • framework & debugging
Playwright • real-world automation
Interactive practice lab
Try the controls below and observe the corresponding Playwright locator instructions. This browser demo does not execute Node.js or Playwright Test; copy the code to your local Playwright project to automate it.
Task manager demo
Suggested automation
Actions on the demo update these examples. In your local test use a page that contains the same controls.
Download a standalone lab page, then serve it locally (for example with Python's http.server). Navigate to it in a Playwright test.