Thursday, January 29, 2026
HomeLanguagesJavascriptLodash _.forInRight() Method

Lodash _.forInRight() Method

The Lodash _.forInRight() Method is like _.forIn() method except that it iterates over properties of the object in the opposite order using iteratee function.

Syntax:

_.forInRight( object, iteratee_function)

Parameters:This method accepts two parameters as mentioned above and described below:

  • object: This is the object to find in.
  • iteratee_function: the function that is invoked per iteration.

Return Value: This method returns an object.

Example 1:




// Defining Lodash variable 
const _ = require('lodash'); 
  
var users = {
  'a':  1,
  'b':  2,
  'c':  3
};
   
_.forInRight(users, function(value, key) {
  console.log(key);
});


Output:

c
b
a

Example 2:




// Defining Lodash variable 
const _ = require('lodash'); 
  
var users = {
  'a':  1,
  'b':  2,
  'c':  3
};
   
_.forInRight(users, function(value, key) {
    if(value > 1) {
        console.log(key, value);
    }
});


Output:

c 3
b 2

Note: This will not work in normal JavaScript because it requires the lodash library to be installed and can be installed using the following command:

npm install lodash
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32476 POSTS0 COMMENTS
Milvus
122 POSTS0 COMMENTS
Nango Kala
6848 POSTS0 COMMENTS
Nicole Veronica
11978 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12065 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7221 POSTS0 COMMENTS
Thapelo Manthata
6934 POSTS0 COMMENTS
Umr Jansen
6916 POSTS0 COMMENTS