📜  Lodash _.sneq() 方法

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

Lodash _.sneq() 方法

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

句法:

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

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

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

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

示例 1:

Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( 1, 2, 3 ); 
    
console.log("Each arguments are not "
    + "equal to each other :", eq);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( 2, 2, 2 );
    
console.log("Each arguments are not "
    + "equal to each other :", eq);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( "2", 2, 2 );
    
console.log("Each arguments are not "
    + "equal to each other :", eq);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( "2", "2", "2" );
    
console.log("Each arguments are not "
    + "equal to each other :", eq);


输出:

Each arguments are not equal to each other : true

示例 2:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( 2, 2, 2 );
    
console.log("Each arguments are not "
    + "equal to each other :", eq);

输出:

Each arguments are not equal to each other : false

示例 3:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( "2", 2, 2 );
    
console.log("Each arguments are not "
    + "equal to each other :", eq);

输出:

Each arguments are not equal to each other : true

示例 4:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var eq  = _.sneq( "2", "2", "2" );
    
console.log("Each arguments are not "
    + "equal to each other :", eq);

输出:

Each arguments are not equal to each other : false