-1

I've looked everywhere and can't find a solution. I'm using the console part of developer tools on chrome if that helps :)

I've tried various configurations such as the example below, and all give me an error

setTimeout(s)5
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
alex
  • 1
  • What is the error that you are getting? – Get Off My Lawn Apr 02 '20 at 22:14
  • 1
    Answered here: https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep – Ed Lucas Apr 02 '20 at 22:15
  • 1
    Create a promise that sets timeout and await it – Ahmed I. Elsayed Apr 02 '20 at 22:18
  • 1
    This is likely not working because A) You haven't declared `s` as a function, or B) because you typed it exactly as shown above (the code's malformed) instead of `(s)5` you should try `(s, 5000)` (JS handles time in milliseconds, not seconds)... If that doesn't suit your needs, then see my answer below... – 255.tar.xz Apr 02 '20 at 22:25

1 Answers1

2

I'm not sure exactly what you are trying to do, but I think you need to pass a function and the length of timeout into the setTimeout method like this example

setTimeout(function(){ alert("Hello"); }, 3000);
PhilCowan
  • 523
  • 5
  • 13