Technical skill practice

JavaScript toLowerCase: Normalize a Label Without Changing Its Source

Use toLowerCase to obtain a lower-case string. The source string value remains unchanged. If the comparison depends on a particular language’s casing rules, test the locale-aware alternative and define that locale explicitly.

The task

Normalize a command label and compare the letter I under ordinary lowercasing and Turkish locale-aware lowercasing. This is a casing experiment, not an authentication or identity-normalization policy.

Runnable Node 22 example

const assert = require('node:assert/strict');

const source = 'READY';
const normalized = source.toLowerCase();
assert.equal(normalized, 'ready');
assert.equal(source, 'READY');
assert.equal('I'.toLowerCase(), 'i');
assert.equal('I'.toLocaleLowerCase('tr'), 'ı');
assert.equal(' Ready '.toLowerCase(), ' ready ');
console.log(`${normalized}; ordinary=${'I'.toLowerCase()}; tr=${'I'.toLocaleLowerCase('tr')}`);

Expected output and explanation

The first result is a new string value and the original remains READY. Lowercasing does not trim the surrounding spaces in the additional check, so casing and whitespace policy should be separate decisions.

The Turkish example produces a dotless letter in this runtime, while the ordinary method produces i. That difference matters if language-specific comparisons are intended. Lowercasing is not a guarantee that all Unicode-equivalent spellings become identical or that every case-insensitive search requirement has been satisfied.

Output from the example

ready; ordinary=i; tr=ı

Pitfall to check

Do not quietly normalize a case-sensitive identifier merely because a search looks friendlier afterward. Define what the identifier means, retain the original when needed for display and test the actual language requirements.

Questions, answered

Should I use lowercasing for display text?

Only when the product requires it. For a comparison, you can derive a normalized value while retaining the original label for display.

Sources and examples

ResumizeAI team. Examples are fictional teaching material, not customer results. Replace sample details with your own facts.

Your experience. A complete resume.

Build in Resumize with ATS-friendly templates, guided editing and a live preview. Start free, then upgrade when you need more.

Free account required. Free-plan PDF exports include a watermark.