Skip to content
Related Articles

Related Articles

Improve Article

Lodash _.bitwiseRight() Method

  • Last Updated : 29 Sep, 2020
Geek Week

Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.

The _.bitwiseRight() method is used to return the result of using the Bitwise Right operator (>>) on all the given arguments.

Syntax:

_.bitwiseRight( val1, val2,..., valn )

Parameters: This method takes a variable number of parameters and operates the Bitwise Right operator on them.

Return Value: This method returns the result of using the Bitwise Right operator (>>) on all the arguments.



Note: This will not work in normal JavaScript because it requires the lodash.js contrib library to be installed. Lodash.js contrib library can be installed using npm install lodash-contrib –save.

Example 1:

Javascript




// Adding lodash-contrib library 
var _ = require('lodash-contrib'); 
  
// Using the _.bitwiseRight() method
var bR  = _.bitwiseRight( 1, 3 ); 
    
console.log("The bitwiseRight is :", bR);

Output:

The bitwiseRight is : 0

Example 2:

Javascript




// Adding lodash-contrib library 
var _ = require('lodash-contrib'); 
  
// Using the _.bitwiseRight() method
var bR  = _.bitwiseRight( 5, 1 );
    
console.log("The bitwiseRight is :", bR);

Output:

The bitwiseRight is : 2

Example 3:

Javascript




// Adding lodash-contrib library 
var _ = require('lodash-contrib'); 
  
// Using the _.bitwiseRight() method
var bR  = _.bitwiseRight( 1 ); 
    
console.log("The bitwiseRight is :", bR);

Output:

The bitwiseRight is : 1

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!




My Personal Notes arrow_drop_up
Recommended Articles
Page :