What is a promise?
Assesses fundamental understanding of JavaScript conventions, runtime behavior, and memory/performance considerations.
Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.
A Promise is a JavaScript object that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. It acts as a placeholder for a value that may not be available yet but will be resolved in the future.
A Promise can be in one of three states:
pending: Initial state, neither fulfilled nor rejected.fulfilled: The operation completed successfully.rejected: The operation failed (e.g., due to a network error).
#### Promise Syntax
const promise = new Promise(function (resolve, reject) {
// Perform async operation
});
#### Example: Creating and Using a Promise
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve("I'm a Promise!");
}, 5000);
});
promise
.then((value) => console.log(value)) // Logs after 5 seconds: "I'm a Promise!"
.catch((error) => console.error(error)) // Handles any rejection
.finally(() => console.log("Done")); // Runs regardless of success or failure
In the above example:
- A
Promiseis created to handle an asynchronous operation withresolveandrejectcallbacks. - The
setTimeoutresolves the promise with a value after 5 seconds. .then(),.catch(), and.finally()are used to handle success, errors, and cleanup respectively.
The action flow of a promise will be as below,

Candidate Response Strategy & Interview Tips
- Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
- Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
- Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
- Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.