epam-short-track

Core JS mentors interview #2

TypeScript

  1. What is the difference between TypeScript and JavaScript, and why would you choose TypeScript for a project?
  2. Explain what structural typing is in TypeScript and how it differs from nominal typing.
  3. What are the primitive types in TypeScript, and how are they different from JavaScript’s types?
  4. How do Partial<T> and Required<T> utility types differ, and why would you use them in your code?
  5. What is the difference between never and void in TypeScript, and when would you use each?
  6. What are generics in TypeScript, and how can they make functions or classes more reusable? Provide examples.
  7. How does the Pick<T, K> utility type differ from Omit<T, K>, and when would you use each of them?
  8. Describe the difference between any and unknown in TypeScript and discuss scenarios where one should be preferred over the other.
  9. How does the use of interface differ from type in TypeScript, and when would you choose one over the other?
  10. What is the purpose of the readonly modifier in TypeScript, and how does it differ from a const variable?

Object-Oriented Programming (OOP)

  1. What is the difference between public, private, protected and static members in a TypeScript/JavaScript class, and what are their use cases?
  2. Discuss SOLID principles and how they apply to Object-Oriented Programming in JavaScript or TypeScript.
  3. What is the instanceof operator in JavaScript, and how does it work when checking if an object belongs to a specific class?
  4. How do ES2015 classes simplify creating objects compared to traditional functions and prototypal inheritance in JavaScript?
  5. Explain how you can achieve multiple inheritance in TypeScript and how it differs from extending classes in traditional OOP.

Async JavaScript

  1. What is the difference between setTimeout and setInterval in JavaScript, and how can you stop them from running?
  2. What are Promise.all() and Promise.race(), and how do they differ in their behavior when resolving multiple promises?
  3. How does async/await syntax enhances the readability and maintainability of asynchronous JavaScript code compared to traditional promise chains?
  4. What is the role of the finally block in error handling, and how does it interact with try and catch blocks in JavaScript?
  5. How can you create and throw a custom error in JavaScript, and why would you do so? Provide a practical example.