By the end of this tutorial, you’ll use _.valuesIn() to collect own and inherited enumerable property values into an array for inspection and debugging.
_.valuesIn() is like _.values(), but it walks the prototype chain and includes inherited enumerable property values too. Think of it as turning a for...in loop into an array of values—keys are omitted.
💡
Own vs inherited
On a class instance, _.values() might return only ["John", 30], while _.valuesIn() also includes enumerable prototype methods like sayHello.
Use it for object inspection, debugging prototype-augmented instances, and understanding what enumerable values exist beyond own properties. For API payloads and plain config objects, _.values() is usually the safer default.
Foundation
📝 Syntax
The signature takes one argument—the object whose values you want (including inherited):
javascript
_.valuesIn(object)
Syntax Rules
object — any object (instances, plain objects, etc.).
Return value — array of property values from own and inherited enumerable string keys.
Included values — own and inherited enumerable string-keyed properties.
Excluded — non-enumerable props, symbol keys, and nested object internals (not flattened).
Null-safe — returns [] for null or undefined.
javascript
import valuesIn from "lodash/valuesIn";
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype.sayHello = function () {
console.log("Hello, " + this.name);
};
const john = new Person("John", 30);
const allValues = valuesIn(john);
// allValues includes own name/age and inherited sayHello function
Lodash enumerates own and inherited enumerable string-keyed properties, like for...in.
Input
2
Read values
Each enumerable key contributes its current value to the result array.
Collect
3
Return array
A new values array is returned; the original object is untouched.
Output
=
🔍
Ready to inspect
Filter by type, compare with _.values(), or pair with _.keysIn() for debugging.
Important
📝 Notes
_.valuesIn() does not mutate the source object—it returns a new array.
Own and inherited enumerable string-keyed property values are included.
Nested object values are not flattened—each nested object is one array element.
ES class methods on the prototype are usually non-enumerable and will not appear; constructor prototype.method = fn assignments are enumerable and will.
On plain object literals, _.valuesIn() matches _.values().
For own values only, prefer _.values() or native Object.values().
Wrap Up
Conclusion
_.valuesIn() collects own and inherited enumerable property values into one array, making prototype inspection and debugging straightforward. Pair it with _.keysIn() when you need names, or _.toPairsIn() when you need both keys and values.
For everyday data objects, _.values() is the safer default—it skips inherited prototype noise. You have now completed the Lodash object methods tutorial series; explore more from the Lodash Seq hub for method chaining.
Use _.valuesIn for debugging prototype-augmented instances
Compare with _.values to see what is own vs inherited
Pair with _.keysIn when you need parallel key/value arrays
Prefer _.values for API payloads and plain config objects
Filter the result by typeof when separating data from functions
❌ Don’t
Expect _.valuesIn to flatten nested objects recursively
Assume ES class methods appear (they are usually non-enumerable)
Use _.valuesIn for summing sales data when _.values suffices
Serialize the result with JSON.stringify when functions are included
Confuse _.valuesIn with deep value extraction from nested objects
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about _.valuesIn()
Use these when inspecting own and inherited property values.
5
Core concepts
🔗01
Inherited values
Prototype chain.
Core
📦02
Non-mutating
New array.
Important
🗃️03
vs values
Own-only default.
Compare
🔍04
Inspection
Debug instances.
Pattern
🛠️05
keysIn
Names twin.
Pair
❓ Frequently Asked Questions
_.valuesIn() collects the values of an object's own and inherited enumerable string-keyed properties into a new array. Keys are not included—only property values from the prototype chain walk.
_.values() includes only own enumerable property values. _.valuesIn() also includes inherited enumerable values from prototypes—like a for...in loop turned into a values array.
No. _.valuesIn() reads the object and returns a new array. The source object is unchanged.
There is no single Object.values variant for inherited keys. You typically use a for...in loop or manual prototype walking. _.valuesIn() packages that pattern.
No. Like _.values(), it only reads top-level enumerable values on the object and its prototype chain. Nested object values stay as single elements in the array.
Use _.values() for plain data objects, API payloads, and config where inherited prototype methods should not appear. Use _.valuesIn() for debugging or inspecting prototype-augmented instances.
Did you know?
_.valuesIn() is the value-side twin of _.keysIn()—both walk the prototype chain for enumerable string keys. The old tutorial incorrectly suggested using _.flattenDeep(_.valuesIn(...)) to extract nested values; _.valuesIn only reads top-level enumerable properties and does not recurse into nested objects.