Google News
logo
Lodash - Interview Questions
Lodash _.times Method
The _.times() executes the function n times.
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">
  _.times(4, () => {
   console.log("Learning");
  })
    </script>
</head>
<body></body>
</html>
 
In the example, we execute the inner function four times. The function prints a word to the console.
Learning
Learning
Learning
Learning
Advertisement