Lodash _.stubTrue() Method
Lodash _.stubTrue() method is used to return a true value. It always returns true when it is called.
Syntax:
_.stubTrue();
Parameters:
This method does not accept any single parameter.
Return Value:
It returns a true value.
Example 1: In this example, this method is returning true and we are printing that result in the console.
Javascript
// Requiring the lodash library const _ = require( "lodash" ); // Use of _.stubTrue() method let gfg = _.stubTrue(); // Printing the output console.log(gfg); |
Output :
true
Example 2: In this example, this method is returning true in a for loop and we are printing that result in the console.
Javascript
// Requiring the lodash library const _ = require( "lodash" ); for (let i = 0; i < 10; i++) { // Printing the output console.log(_.stubTrue()); } |
Output :
true
true
true
true
true
true
true
true
true
true
Contact Us