Property, not method: Read _.VERSION directly. Do not call _.VERSION() — it is a string, not a function.
Definition
What Is _.VERSION?
A string property on the Lodash namespace that holds the semantic version number of the build you loaded (for example "4.17.21"). Stable metadata — not deprecated.
Trace how the version string reaches your console, from the official docs.
Walkthrough
1. Load Lodash (npm / CDN / bundler)
2. Build embeds VERSION = "x.y.z"
3. You read _.VERSION → that string
console.log(_.VERSION)
// → "4.17.21" (this page’s CDN)
// Wrong: treat it like a method
_.VERSION() // TypeError — string is not a function
Code
Lodash Examples
Short, copy-ready snippets. Open DevTools, or use Try It Yourself for a live editor.
Pin in the URL. A CDN path like [email protected] declares the intended build.
Read runtime._.VERSION reports what actually executed.
Compare exactly. String equality is safe when you expect one known build.
Mismatch clue. A false match often means a cached older file or a different script tag.
Example 4 — Why String >= Is Wrong
Lexicographic string compare is not semver — avoid the old _.VERSION >= "…" pattern.
Lodash
// WRONG — string compare is not semver
console.log("4.17.9" >= "4.17.10"); // true (incorrect!)
// OK — exact pin
if (_.VERSION !== "4.17.21") {
console.warn("Unexpected Lodash", _.VERSION);
}
// OK — ranges need a real semver library
// semver.satisfies(_.VERSION, "^4.17.0")
See the bug. As strings, "4.17.9" is “greater” than "4.17.10" after the shared prefix.
Prefer exact pins. Equality checks are correct when one Docker image or CDN pin is expected.
Use semver for ranges. Packages like semver parse major/minor/patch properly.
Feature-detect carefully. Prefer docs and tests over branching on patch numbers alone.
Edge Cases & Pitfalls
Check these before relying on _.VERSION in real projects.
trap
Do not call _.VERSION()
It is a string property. Calling it throws TypeError.
semver
String >= is not semver
"4.17.9" >= "4.17.10" is true as strings. Use exact pins or a semver library.
import
Missing on modular imports
lodash/map and similar paths do not expose VERSION. Use the full _ namespace or package.json.
features
Not for feature detection
Prefer tests and docs over branching production logic on patch numbers alone.
Compatibility
Browser & Runtime Support
_.VERSION ships with full Lodash builds. It is available wherever you load the library — evergreen browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Full Lodash build
_.VERSION
Present on [email protected] full builds and CDN scripts. Not exported by per-method modular imports such as lodash/get.
100%With full Lodash
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
_.VERSIONFull build
Bottom line: Safe for diagnostics once Lodash is loaded. Read _.VERSION after import _ from "lodash" or a CDN script. For declared dependency version in Node, also check package.json / npm list lodash.
Analysis
Performance Notes
Approach
Cost
Best for
_.VERSION
O(1)
Runtime debug / pin check
package.json version
I/O / build-time
CI, audits, lockfiles
CDN URL pin
n/a
Static HTML without a bundler
Reading _.VERSION is a plain property access — negligible cost. Log it once at startup if needed; there is no benefit to reading it in hot loops.
Remember
Key Takeaways
Role: string property with the loaded Lodash semver.
Access: read _.VERSION — never call it as a function.
Use: debug logs and exact CDN / image pin checks.
Avoid: string >= for semver ranges.
One line:_.VERSION is a read-only string that tells you which Lodash build is running.
Frequently Asked Questions
_.VERSION is a string property on the Lodash object that reports the semantic version of the library loaded in your runtime—for example "4.17.21". It is metadata, not a function.
Access it like any property: _.VERSION after importing Lodash, or lodash.VERSION if you saved the namespace after _.noConflict().
No. It is set when Lodash loads and stays constant for that copy. Reload the page or restart Node to pick up a newly installed version.
Avoid it. Lexicographic string compare is not semver ("4.17.9" >= "4.17.10" is true as strings). Use exact equality, parse major/minor, or the semver package for ranges.
No. lodash/get and similar modular imports do not export VERSION. Use the full namespace (import _ from "lodash") or read version from package.json in Node.
Startup debug logs, support tickets, verifying a CDN pin, and confirming the browser build matches what your team expects—not for production feature detection.