Returns the last own enumerable string key whose value satisfies the predicate, or undefined if nothing matches. Same rules as _.findKey, reverse scan. Since Lodash 2.0.0.
Pass the object and path or keys shown below. Check whether the helper mutates or returns a new object.
Syntax
Call _.findLastKey. Start with this line.
Lodash
_.findLastKey(object, [predicate=_.identity])
Call
What it does
_.findLastKey(object, [predicate=_.identity])
Primary signature.
_.findLastKey(object)
Work with an object’s keys, values, or paths.
Prefer import findLastKey from "lodash/findLastKey" when you want a smaller bundle.
Library declarations
Lodash
_.findLastKey(object, [predicate=_.identity])
Parameters
Parameter
Description
object
Required. Source object to scan
predicate
Optional. Defaults to _.identity (last truthy value)
Dotted key in a matcher object is a literal property name.
Nested / array forms find the last admin → "ops".
findKey with the same nested matcher would return "root".
Compatibility
Browser & Runtime Support
_.findLastKey is a Lodash Object helper (since 2.0.0). It runs anywhere Lodash 4.x runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 2.0.0+
_.findLastKey()
Available in [email protected] full builds and the lodash/findLastKey modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.findLastKeyLodash 2.0.0+
Bottom line: Safe for production once Lodash is loaded. Prefer import findLastKey from "lodash/findLastKey". Use findKey when you need the first match.
Frequently Asked Questions
The last own enumerable string key whose value satisfies the predicate, or undefined when nothing matches.
Same predicate rules and return type. findKey scans forward (first match); findLastKey scans in reverse (last match).
(value, key, object). Value comes first — same shape as _.findKey and _.find.
Function; string property (truthy test); [path, value] matchesProperty pair; and a plain object used as a partial-deep matcher.
No. Nest the object ({ details: { isAdmin: true } }) or use ['details.isAdmin', true] with the array shorthand.
Own enumerable string keys only. Inherited and symbol keys are skipped.