D
D
DMITRY Chernenkiy2021-07-03 11:45:41
JavaScript
DMITRY Chernenkiy, 2021-07-03 11:45:41

How to make a function with a promise work in a second?

There is a function inside it should be a promise and which has a .then part, this part should work in a second, how to write it?

function delay(time) {
        //здесь мог быть ваш  код
      }
      delay(1000).then(console.log("hello"));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-07-03
@Nikonorovich

//your code could be here
funny, yes.
https://www.30secondsofcode.org/js/s/sleep

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question