📜  Lodash _.seq() 方法

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

Lodash _.seq() 方法

Lodash _.seq() 方法检查每个参数是否严格相等 (===) 并返回相应的布尔值。

句法:

_.seq( val1, val2, ..., valn );

参数:这个方法需要n个值来操作它们_.seq()方法。

返回值:此方法返回一个布尔值。

注意:这在普通 JavaScript 中不起作用,因为它需要安装 lodash.js contrib 库。 Lodash.js contrib 库可以使用npm install lodash-contrib –save 安装

示例 1:

Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( 6, 6, 6 ); 
    
console.log("Each of the arguments is equal to others :", eq);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( "gfg", "gfg", "gfg" ); 
    
console.log("Each of the arguments is equal to others :", eq);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( 1, "1", 1 ); 
    
console.log("Each of the arguments is equal to others :", eq);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( 1, 12, 1 );
    
console.log("Each of the arguments is equal to others :", eq);


输出:

Each of the arguments is equal to others : true

示例 2:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( "gfg", "gfg", "gfg" ); 
    
console.log("Each of the arguments is equal to others :", eq);

输出:

Each of the arguments is equal to others : true

示例 3:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( 1, "1", 1 ); 
    
console.log("Each of the arguments is equal to others :", eq);

输出:

Each of the arguments is equal to others : false

示例 4:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.seq( 1, 12, 1 );
    
console.log("Each of the arguments is equal to others :", eq);

输出:

Each of the arguments is equal to others : false