Function sleep

  • Blocks execution for a given amount of time

    Parameters

    • ms: number

      The sleep duration in milliseconds

    Returns void

    Node.js uses an asynchronous event loop. This function provides a simple way to block execution for a given amount of time, while still allowing scripting events, like debugger messages to be processed. If your script is designed to be asynchronous, you shouldn't need this function.