Lodash _.VERSION Property

Beginner
⏱️ 4 min read
📚 Updated: Oct 2026
🎯 4 Code examples
🚀 4 Try-it labs

Property, not method: Read _.VERSION directly. Do not call _.VERSION() — it is a string, not a function.

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.

Remember
_.VERSION

// → "4.17.21"  (matches your loaded build)

typeof _.VERSION
// → "string"
NeedUse
Read loaded version_.VERSION
After renaming _lodash.VERSION
Declared npm versionpackage.json / npm list lodash
Fresh Lodash copy_.runInContext()

How to Use _.VERSION

Load Lodash, then read the property — no arguments, no call.

  1. Import or require the full Lodash namespace (or load it from a CDN).
  2. Read _.VERSION — a string like "4.17.21".
  3. Log it for debugging, or compare with an exact expected pin.
  4. Do not use string >= for semver ranges; use exact match or a semver library.
PieceRequiredMeaning
ArgumentsNoneProperty access only
Return type—Always a string
Full namespaceYesNot on lodash/get-style imports

Pseudocode

Pseudocode
// Lodash build embeds:
VERSION = "x.y.z"   // from that release

read:
  return VERSION    // no compute, no args

Cheat Sheet

Keep these facts handy when checking which Lodash build is running.

TopicDetail
Syntax_.VERSION
Official meaningSemantic version number (string)
Type"string" — not a function
Callable?No — never write _.VERSION()
Exact pin OK_.VERSION === "4.17.21"
Range compareUse semver package — not string >=
Importimport _ from "lodash" (full build)
Official docslodash.com/docs — _.VERSION

Live Preview

Inspect the Lodash build loaded on this page (official VERSION docs).

Browser demo of _.VERSION via Lodash 4.17.21 CDN.

Result
_.VERSION
→ "4.17.21"

Worked Walkthrough

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

Lodash Examples

Short, copy-ready snippets. Open DevTools, or use Try It Yourself for a live editor.

Example 1 — Read _.VERSION

Print the version string and confirm its type.

Lodash
console.log(_.VERSION);
// → "4.17.21"

console.log(typeof _.VERSION);
// → "string"
Try It Yourself

How It Works

  1. Load Lodash. The CDN (or npm) delivers a build that embeds a version constant.
  2. Read the property. _.VERSION returns that string — no function call.
  3. Check the type. typeof is "string", which explains why _.VERSION() fails.
  4. Match your install. The value equals the version field of the Lodash package you loaded.

Example 2 — Startup Debug Banner

Include the Lodash version in a boot log so support tickets capture the right context.

Lodash
function boot() {
  console.info("[app] Lodash", _.VERSION, "ready");
}

boot();
// → [app] Lodash 4.17.21 ready
Try It Yourself

How It Works

  1. Define a boot helper. One place logs environment details at startup.
  2. Interpolate VERSION. The string is cheap to read and stable for that page load.
  3. Ship context. Staging vs production mismatches show up immediately in logs.
  4. Keep it light. Prefer verbose/debug modes — avoid noisy production spam.

Example 3 — CDN Pin Check

Verify the runtime string matches the version you pinned in the script URL.

Lodash
var expected = "4.17.21";
var runtime = _.VERSION;

console.log("expected:", expected);
console.log("runtime: ", runtime);
console.log("match:", expected === runtime);
// → match: true
Try It Yourself

How It Works

  1. Pin in the URL. A CDN path like [email protected] declares the intended build.
  2. Read runtime. _.VERSION reports what actually executed.
  3. Compare exactly. String equality is safe when you expect one known build.
  4. 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")
Try It Yourself

How It Works

  1. See the bug. As strings, "4.17.9" is “greater” than "4.17.10" after the shared prefix.
  2. Prefer exact pins. Equality checks are correct when one Docker image or CDN pin is expected.
  3. Use semver for ranges. Packages like semver parse major/minor/patch properly.
  4. 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.

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 Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.VERSION Full 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.

Performance Notes

ApproachCostBest for
_.VERSIONO(1)Runtime debug / pin check
package.json versionI/O / build-timeCI, audits, lockfiles
CDN URL pinn/aStatic 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.

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.

Next: Express Introduction

You finished the Lodash track — continue with Express.js HTTP servers.

Express tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful