Explorer
Node.js

Write a function `delayedValue(val)` that returns a Promise which resolves with `val` immediately.

Problem Statement

Write a function `delayedValue(val)` that returns a Promise which resolves with `val` immediately.

Complexity

Time Complexity: -

Space Complexity: -

Hints

šŸ’” Hint 1: A Promise is created with: new Promise((resolve, reject) => { ... }). šŸ’” Hint 2: Call resolve(val) to fulfill the promise with the given value. šŸ’” Hint 3: You can also use Promise.resolve(val) for immediate resolution. āœ… Solution: ```javascript function delayedValue(val) { return Promise.resolve(val); } ```

Promise Basics

Easy
Write a function `delayedValue(val)` that returns a Promise which resolves with `val` immediately.
Editor
Loading Editor...
Evaluate code
Output:Click "Run" above to execute and verify your code here.
"is_promise"