+ 6

How to set an Interval/Timeout in Javascript without calling any function?

I found two lessons in JS where you call functions and the time. And somehow worked, but is there a way to set an Interval or Timeout without calling a function? Like in python, time.sleep() exists, how do I do it?

2nd Oct 2019, 2:36 PM
OfficialAz3
OfficialAz3 - avatar
1 Answer
0
It is usually avoided in javascript to do things like `Time.sleep` because this would block the main thread (blocking the main thread means no javascript can run at that time so those menu /sidebar will not open or close on button clicks) but you can get Time.sleep like thing from external library.
2nd Oct 2019, 2:46 PM
Saurabh Sharma
Saurabh Sharma - avatar