Explain JS types, Promises, Maps, WebSockets

Quick Overview

Explain JS types, Promises, Maps, WebSockets evaluates requirements, assumptions, structured reasoning, trade-offs, and verification in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

Explain JS types, Promises, Maps, WebSockets

Company: Citadel

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Technical Screen

Discuss JavaScript data types and common data structures. Which values coerce to false in a boolean context? For Promises, what do then/catch/finally handlers return, and what happens to the returned Promise if an error is thrown in the executor or in any handler (including within an async function)? Compare plain objects and Map in terms of key types, iteration order, default properties, performance, and typical use cases. What is a WeakMap, and how do its key constraints and garbage-collection behavior differ from Map? For WebSockets, explain whether a single connection guarantees in-order, reliable delivery of messages, when ordering might be affected (e.g., multiple connections, reconnections, server fan-out), and how you would design for ordering/idempotency if required.

Quick Answer: Explain JS types, Promises, Maps, WebSockets evaluates requirements, assumptions, structured reasoning, trade-offs, and verification in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

|Home/Software Engineering Fundamentals/Citadel
Citadel logo
Citadel
Jul 26, 2025, 12:00 AM
mediumSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
14
0

Explain JS types, Promises, Maps, WebSockets

JavaScript Types, Promises, Collections, and WebSocket Ordering

You are interviewing for a software engineering role. Answer the following about JavaScript runtime behavior, collections, and networking:

1) Data Types and Data Structures

  • List JavaScript primitive types vs reference types.
  • Name common built-in data structures used in practice.
  • Which values coerce to false in a boolean context?

2) Promises: Return Values and Error Propagation

  • What do then / catch / finally return?
  • What happens if an error is thrown in the Promise executor or in any handler (including inside an async function)?

3) Plain Objects vs Map

Compare by:

  • Key types allowed
  • Iteration order
  • Default/inherited properties and collision issues
  • Performance characteristics (adds/removes/lookups)
  • Typical use cases

4) WeakMap

  • What is it?
  • How do its key constraints and garbage-collection behavior differ from Map ?

5) WebSockets and Message Ordering

  • Does a single WebSocket connection guarantee in-order, reliable delivery?
  • When can ordering be affected (e.g., multiple connections, reconnections, server fan-out)?
  • How would you design for ordering and/or idempotency if required?

Constraints & Assumptions

  • Preserve the scope, facts, inputs, and requested outputs from the prompt above.
  • If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
  • Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.

Clarifying Questions to Ask Guidance

  • Clarify the goal, inputs, constraints, stakeholders, and success criteria.
  • State assumptions before using them.
  • Keep the answer grounded in the prompt rather than adding outside facts.

What a Strong Answer Covers Guidance

  • A structured framing of the problem and constraints.
  • A concrete approach with trade-offs and edge cases.
  • A way to validate the answer and communicate the recommendation.

Follow-up Questions Guidance

  • What assumption is most important to validate first?
  • What could make the answer fail in practice?
  • How would you explain the result to a non-technical stakeholder?
Loading comments...