TestingDocs.com logoTestingDocs.com
Automation learning lab
TestingDocs • Self-paced course

Playwright Automation
Self Study Guide

Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.

60 chaptersBeginner friendlyHands-on practice
JavaScript / Chapter 13 of 60~12 min • Beginner
Chapter 13JavaScript

Objects and properties

Objects group related named properties. Dot notation reads a known property; bracket notation can use a dynamic property name. Test data often contains objects describing users, products or environments.

How it works

Step-by-step walkthrough

  1. Create a user object
  2. Access a property
  3. Read a dynamic key

Example

JavaScript
const user = { name: 'Learner', role: 'QA' };
const key = 'role';
console.log(user.name, user[key]);
Expected result: Learner QA
💡 Point to remember
Do not put real credentials into source-controlled test data.

✎ Your practice task

Add an active property with value true.

Knowledge check

How do you access a dynamic key variable?

🌐 Continue learning