📜  Lodash _.bitwiseZ() 方法

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

Lodash _.bitwiseZ() 方法

Lodash _.bitwiseZ() 方法返回对所有参数使用按位 >>>运算符的结果。

句法:

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

参数:此方法需要 n 个值对其进行操作按位 >>>运算符。

返回值:此方法返回对所有参数使用按位 >>>运算符的结果。

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

示例 1:

Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 5 ); 
    
console.log("The bitwiseZ is :",bZ);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 1, 4, 6, 8 ); 
    
console.log("The bitwiseZ is :",bZ);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 72, 36 ); 
    
console.log("The bitwiseZ is :",bZ);


Javascript
// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 72, 36, 2 ); 
    
console.log("The bitwiseZ is :",bZ);


输出:

The bitwiseZ is : 5

示例 2:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 1, 4, 6, 8 ); 
    
console.log("The bitwiseZ is :",bZ);

输出:

The bitwiseZ is : 0

示例 3:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 72, 36 ); 
    
console.log("The bitwiseZ is :",bZ);

输出:

The bitwiseZ is : 4

示例 4:

Javascript

// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
var bZ  = _.bitwiseZ( 72, 36, 2 ); 
    
console.log("The bitwiseZ is :",bZ);

输出:

The bitwiseZ is : 1