The _.forOwnRight()
method in lodash iterates over own enumerable string keyed properties of an object in reverse order. The iteration is done using the for..in
statement. It is similar to the _.forOwn()
method, but the iteration order is reversed.
Here's an example of how to use the _.forOwnRight()
function:
index.tsx235 chars18 lines
In this example, myObj
is an object with 3 properties. The _.forOwnRight()
method is used to iterate over the properties in reverse order. The function passed as the second argument to _.forOwnRight()
is called for each property, with the property value and key as its arguments. In this case, the function logs each property and its value to the console in reverse order.
gistlibby LogSnag