Home Lodash String methods _.lowerFirst() Lodash _.lowerFirst() Method Overview
What You’ll Learn By the end of this tutorial, you’ll confidently use Lodash’s _.lowerFirst() method in real JavaScript projects.
01
Core syntax Call _.lowerFirst(string) for camelCase.
02
First char only Rest of string unchanged.
03
Identifiers Convert PascalCase to camelCase.
04
API keys Normalize object property names.
05
vs lowerCase Single char vs full string.
06
Pair upperFirst Round-trip casing helpers.
Fundamentals
What Is _.lowerFirst()? It lowercases the first character of a string and leaves all other characters unchanged.
💡
Beginner tip Import only what you need: import lowerFirst from "lodash/lowerFirst" keeps bundles small.
Foundation
📝 Syntax _.lowerFirst([string='']) import lowerFirst from "lodash/lowerFirst";
const original = "HelloWorld";
const result = lowerFirst(original);
console.log(result);
// -> "helloWorld" Cheat Sheet
⚡ Quick Reference Task Code pattern Result PascalCase fix _.lowerFirst('HelloWorld')helloWorld Label to key _.lowerFirst('UserName')userName Map object keys _.mapKeys(obj, (_, k) => _.lowerFirst(k))camelCase keys Array of names names.map(_.lowerFirst)Batch convert Opposite _.upperFirst(str)HelloWorld Full lower _.lowerCase(str)hello world
Mutates? NoReturns new string
Scope First charRest unchanged
Style camelCaseJS identifiers
Opposite _.upperFirst()Capitalize first
Reference
🧰 Parameters Every argument to _.lowerFirst() and what it controls:
stringOptional
The string to transform. When omitted or empty, returns an empty string.
_.lowerFirst('HelloWorld')return valueNew string
First character lowercased; all following characters unchanged. The original string is not mutated.
// -> 'helloWorld'scopeImportant
Only index 0 is modified. Internal capitals like jOhN stay as-is after the first character.
_.lowerFirst('jOhN')pair withmapKeys
Combine with _.mapKeys to rename PascalCase API keys to camelCase in one pass.
_.mapKeys(obj, (_, k) => _.lowerFirst(k))Hands-On
Examples Gallery Practical _.lowerFirst() patterns with copy-ready code and interactive Try It Yourself labs.
Basic Format Transform Batch Already Pair 📚 Getting Started Lowercase the first character while preserving the rest.
Example 1 — Basic PascalCase to camelCase Convert a capitalized identifier to camelCase style.
const original = "HelloWorld";
const result = _.lowerFirst(original);
console.log(result);
// -> "helloWorld" How It Works Only H changes; elloWorld stays the same.
📈 Practical Patterns Format labels, user input, and object keys.
Example 2 — Format a property name Turn a label-style name into a camelCase object key.
const label = "UserName";
const key = _.lowerFirst(label);
console.log(key);
// -> "userName" How It Works Common when mapping UI labels to JavaScript property names.
Example 3 — Transform API request keys Convert PascalCase keys from an external API to camelCase.
const requestData = {
UserName: "john_doe",
EmailAddress: "john@example.com"
};
const formatted = _.mapKeys(requestData, (_, key) =>
_.lowerFirst(key)
);
console.log(formatted);
// -> { userName: "john_doe", emailAddress: "john@example.com" } formatted: { userName: "john_doe", emailAddress: "john@example.com" } How It Works Combine with _.mapKeys to reshape objects in one step.
Example 4 — Batch transform with map Apply lowerFirst to every item in an array of field names.
const fields = ["FirstName", "LastName", "EmailAddress"];
const camelFields = fields.map(_.lowerFirst);
console.log(camelFields);
// -> ["firstName", "lastName", "emailAddress"] camelFields: ["firstName", "lastName", "emailAddress"] How It Works Pass _.lowerFirst directly as a callback to map.
🚀 Beyond the Basics Edge cases and comparison with related helpers.
Example 5 — Already lowercase first character Strings that already start lowercase are returned effectively unchanged.
const input = "jOhN";
const result = _.lowerFirst(input);
console.log(result);
// -> "jOhN" (first char already lower) How It Works Only the first character is considered; other capitals remain.
Example 6 — Pair with _.upperFirst() See lowerFirst and upperFirst as inverse first-character operations.
import lowerFirst from "lodash/lowerFirst";
import upperFirst from "lodash/upperFirst";
const camel = "helloWorld";
const pascal = "HelloWorld";
console.log(upperFirst(camel)); // -> "HelloWorld"
console.log(lowerFirst(pascal)); // -> "helloWorld"
// Round-trip:
console.log(lowerFirst(upperFirst(camel))); // -> "helloWorld" upperFirst("helloWorld"): HelloWorld
lowerFirst("HelloWorld"): helloWorld
round-trip: helloWorld How It Works Use together when normalizing identifiers from different sources.
🧠 How _.lowerFirst() Works 1
Receive input string Lodash coerces null/undefined to empty string.
Input
2
Read first character Only the initial code unit is targeted.
First
3
Lowercase if needed Uppercase first letter becomes lowercase.
Transform
=
Concatenate remainder Original tail is appended unchanged.
Output
Important
📝 Notes _.lowerFirst() affects only the first character .For full camelCase from arbitrary strings, use _.camelCase() . Surrogate pairs (some emoji) may need extra care—test edge cases. Pair with _.upperFirst() for round-trip formatting. Empty strings return empty strings. Does not insert or remove spaces between words. Wrap Up
Conclusion _.lowerFirst() is the precise tool when you need camelCase identifiers from PascalCase names—only the first letter changes, so UserName becomes userName without touching internal capitals.
For full string restructuring or search normalization, use _.camelCase() or _.lowerCase() instead.
Pro Tips
💡 Best Practices ✅ Do Use for PascalCase to camelCase conversion Map API keys with _.mapKeys and lowerFirst Pass as callback to Array.map for batch work Keep identifier formatting in one utility Test empty strings and single-character input ❌ Don’t Use when you need full lowerCase word spacing Expect it to lowercase every capital letter Confuse with _.camelCase for arbitrary strings Assume it handles multi-code-point graphemes always Mutate strings in place (strings are immutable) Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about _.lowerFirst() 01
First only One char changes.
Basics 02
camelCase JS identifiers.
Pattern 03
mapKeys API normalization.
Object 04
lowerCase Full string style.
Compare 05
upperFirst Opposite helper.
Related ❓ Frequently Asked Questions What does _.lowerFirst() do? It lowercases the first character of a string and leaves all other characters unchanged.
How is it different from _.lowerCase()? _.lowerCase() lowercases the entire string and inserts spaces between words. _.lowerFirst() only affects the first character.
When should I use _.lowerFirst()? When converting PascalCase or capitalized names to camelCase JavaScript identifiers or JSON keys.
What about an already lowercase first char? The string is returned with no effective change to the first character.
Does it handle empty strings? Yes. An empty string is returned unchanged.
Is there an opposite method? Yes. _.upperFirst() uppercases only the first character.
Did you know?
_.lowerFirst() is the inverse of _.upperFirst() —both touch only the first character. For full camelCase from arbitrary strings (with word splitting), use _.camelCase() instead.
Practice _.lowerFirst() in the Live Editor Open the Try It editor and run the examples with your own input.
Open Try It editor → About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
6 people found this page helpful
Helpful Share Copy link Suggestion