Lodash _.stubTrue()方法用於返回真實值。調用時始終返回true。
用法:
_.stubTrue()
參數:此方法不接受任何單個參數。
返回值:它返回一個真值。
範例1:
Javascript
// Requiring the lodash library
const _ = require("lodash");
// Use of _.stubTrue() method
let gfg = _.stubTrue();
// Printing the output
console.log(gfg);
輸出:
true
範例2:
Javascript
// Requiring the lodash library
const _ = require("lodash");
for(let i = 0; i < 10; i++){
// Printing the output
console.log( _.stubTrue() );
}
輸出:
true true true true true true true true true true
注:本文由純淨天空篩選整理自GeeksforGeeks大神的英文原創作品 Lodash _.stubTrue() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。