Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Lodash _.stubTrue() Method

  • Last Updated : 09 Sep, 2020

The Lodash _.stubTrue() method is used to return a true value. It always returns true when it is called.

Syntax: 

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

_.stubTrue()

Parameters: This method does not accept any single parameter. 

Return Value: It returns a true value.



Example 1:

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:

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!