📜  Lodash _.stubString() 方法

📅  最后修改于: 2022-05-13 01:56:28.257000             🧑  作者: Mango

Lodash _.stubString() 方法

Lodash _.stubString() 方法用于创建一个空字符串。

句法:

_.stubString()

参数:此方法不接受任何参数。

返回值:此方法返回一个空字符串。

示例 1:

Javascript
// Requiring the lodash library  
const _ = require("lodash");            
    
// Use of _.stubString() method 
// to create an empty String
let gfg = _.stubString(); 
        
// Printing the output  
console.log(gfg);


Javascript
// Requiring the lodash library  
const _ = require("lodash");            
    
// Use of _.stubString() method 
// to create 5 empty String
let gfg = _.times(5, _.stubString); 
        
// Printing the output  
console.log(gfg);


输出 :

""

示例 2:

Javascript

// Requiring the lodash library  
const _ = require("lodash");            
    
// Use of _.stubString() method 
// to create 5 empty String
let gfg = _.times(5, _.stubString); 
        
// Printing the output  
console.log(gfg);

输出 :

["", "", "", "", ""]