Frontend track

JavaScript interview questions and answers

Panel-ready Frontend Master questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.

41 Moderate TypeScript Frontend

How do you type a React component's props?

Short take Full answer on next page

Simple meaning

I define a Props interface and annotate the function parameter.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
42 Moderate TypeScript Frontend

What is unknown versus any?

Short take Full answer on next page

Simple meaning

Any turns off checking, so I can access any property and hide bugs.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
43 Moderate TypeScript Frontend

How do union types help with API response states?

Short take Full answer on next page

Simple meaning

I model idle, loading, success with data, and error with a message as a discriminated union.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
44 Moderate Web APIs Frontend

What is Intersection Observer used for?

Short take Full answer on next page

Simple meaning

It tells you when an element enters the viewport without scroll listeners.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
45 Moderate Web APIs Frontend

What is the History API?

Short take Full answer on next page

Simple meaning

PushState and replaceState change the URL without a full reload, which SPAs use for routing.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
47 Moderate JavaScript Frontend

What is optional chaining?

Short take Full answer on next page

Simple meaning

The question mark dot stops the lookup and returns undefined if the left side is null or undefined.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
49 Moderate JavaScript Frontend

What memory leak might you cause with addEventListener?

Short take Full answer on next page

Simple meaning

If I add a window resize listener in useEffect and forget the cleanup, the handler keeps the component closure alive after unmount.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
50 Moderate TypeScript Frontend

What is a generic in TypeScript at a practical level?

Short take Full answer on next page

Simple meaning

A generic is a type parameter so a function or component works with many shapes while keeping the relationship.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
51 Moderate JavaScript Frontend

What is the difference between slice and splice?

Short take Full answer on next page

Simple meaning

Slice returns a shallow copy of a portion and does not change the original, which is what I want in React.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
55 High TypeScript Frontend

What is declaration merging and when does it bite you?

Short take Full answer on next page

Simple meaning

Interfaces with the same name in the same scope merge their members, which is useful for extending libraries.

Open the full page for Why, Steps, Example and Key takeaway.

Read full answer Example · Mistake · Say this
Prev Page 3 of 4 Next
Chat with us