Lodash _.stubTrue() Method
Last Updated :
03 Nov, 2023
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
const _ = require( "lodash" );
let gfg = _.stubTrue();
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
const _ = require( "lodash" );
for (let i = 0; i < 10; i++) {
console.log(_.stubTrue());
}
|
Output :
true
true
true
true
true
true
true
true
true
true
Share your thoughts in the comments
Please Login to comment...