The _.random() function produces random values between the inclusive lower and upper bounds.
Learn Lodash JS at Lodash JS Tutorial with Examples.
Learn Lodash JS at Lodash JS Tutorial with Examples.
Lodash _.random() Method Example
<!DOCTYPE html>
<html>
<head>
<title>Lodash Tutorial</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<script type="text/javascript">
// Getting array slice
var r = _.random(15);
console.log(r);
r = _.random(5, 15);
console.log(r);
</script>
</head>
<body></body>
</html>
The above HTML prints below output on the console:
8
7
Comments
Post a Comment