Back
Close

JavaScript promises, mastering the asynchronous

Magus
37.4K views

Let's do some practice with a simple exercice. You must modify the code below based on the following rules:

  • The function job must return a promise object (you are in a NodeJS environment, you can use new Promise)
  • The promise must resolve itself 2 seconds after the call to job and must provide hello world in the data
Change the code to return a promise
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
function job() {
return 'hello world';
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants