Chapter 11: Arrays
Automation learning lab
Playwright Automation
Self Study Guide
Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.
Arrays
Arrays hold ordered collections with zero-based indexes. length gives the number of items. push appends a value and pop removes the last item. Arrays are useful for test inputs and expected results.
How it works
Step-by-step walkthrough
- Create an array
- Access its first item
- Append an item
Example
const cases = ['login', 'logout'];
cases.push('search');
console.log(cases[0], cases.length);Do not use index 1 for the first item.
✎ Your practice task
Remove the final item with pop.
Knowledge check
What is the index of the first item?
🌐 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.