JavaScript and TypeScript Interview Questions for Playwright Testing
46 JavaScript and TypeScript questions with answers for playwright testing roles — 14 easy, 28 medium, 4 hard.
About JavaScript and TypeScript
Covers the language skills behind every Playwright test: promises and async/await, closures, array methods, modules, and TypeScript types, unions, generics and utility types. Many automation interviews include a short coding round, and missing awaits or weak typing are the most common causes of buggy test code, so this topic carries real weight.
What is async/await?
Show answer
What is npm and package.json?
Show answer
How do you handle errors in async code?
Show answer
What are the main data types in JavaScript?
Show answer
What is the difference between TypeScript and JavaScript?
Show answer
What are arrow functions?
Show answer
What is the difference between == and === in JavaScript?
Show answer
What is a Promise and what states can it have?
Show answer
What is the difference between ES modules and CommonJS?
Show answer
How do you read test data from a JSON file and loop over it?
Show answer
What does the nullish coalescing operator do?
Show answer
Tell me how you learned TypeScript quickly for a project.
Show answer
Tell me about a time you learned a new testing tool under a deadline.
Show answer
interface vs type in TypeScript?
Show answer
What are generics in TypeScript?
Show answer
Explain the event loop.
Show answer
What is the difference between map, filter and reduce?
Show answer
What is the difference between null and undefined?
Show answer
What does the optional chaining operator do?
Show answer
What is the difference between a type and an enum in TypeScript?
Show answer
Promise.all vs Promise.allSettled vs Promise.race?
Show answer
What is destructuring and the spread operator?
Show answer
What is the difference between synchronous and asynchronous code?
Show answer
What are interfaces and types in TypeScript?
Show answer
What is hoisting?
Show answer
What are template literals?
Show answer
What are closures?
Show answer
What happens if you forget an await?
Show answer
What are higher-order functions?
Show answer
What are union types and type narrowing in TypeScript?
Show answer
What is the difference between unknown and any in TypeScript?
Show answer
What are Partial, Pick, Omit and Record used for?
Show answer
Write a typed helper that retries an async function a few times.
Show answer
Why turn on strict mode in tsconfig for a test project?
Show answer
How does this behave in arrow functions compared with regular functions?
Show answer
A test uses forEach with an async callback and the checks inside never seem to run. Why?
Show answer
How do access modifiers help in page object classes?
Show answer
How do you read environment variables safely in a TypeScript test project?
Show answer
How do you check that a product list on the page is sorted by price?
Show answer
What is the difference between a type annotation and a type assertion with as?
Show answer
Describe a time strict TypeScript types caught a bug in your test code.
Show answer
How would you type the response of an API call in TypeScript?
Show answer
Why use readonly and as const for test data?
Show answer
What are discriminated unions and how can they model API responses?
Show answer
What is a generic type parameter constraint, such as T extends object?
Show answer
Frequently asked questions
How important is JavaScript and TypeScript in Playwright Testing interviews?
Covers the language skills behind every Playwright test: promises and async/await, closures, array methods, modules, and TypeScript types, unions, generics and utility types. Many automation interviews include a short coding round, and missing awaits or weak typing are the most common causes of buggy test code, so this topic carries real weight.
How should I use the JavaScript and TypeScript sheet?
Go top to bottom — easy to hard. Answer before opening each answer, tick what you solved and save misses to Last-Minute Revision.