Lodash _.delay Method Example

The _.delay() function delays the execution of a function for the specified amount of milliseconds.

Learn Lodash JS at Lodash JS Tutorial with Examples.

Lodash _.delay Method Example

<!DOCTYPE html>
    <title>Lodash Tutorial</title>
    <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.min.js"></script>

    <script type="text/javascript">
  function message()
   console.log("Some message");
  _.delay(message, 150);
  console.log("Some other message");
The example outputs two messages. The first one is delayed for 150ms. Here is the output:
Some other message
Some message