Google News
logo
Lodash - Interview Questions
Lodash _.delay function
The _.delay() function delays the execution of a function for the specified amount of milliseconds.
Example :
<!DOCTYPE html>
<html>
<head>
    <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");
    </script>
</head>
<body></body>
</html>
 
The example outputs two messages. The first one is delayed for 150ms. Here is the output :

Some other message
Some message
Advertisement