JavaScript toUpperCase(): Convert Text to Uppercase

The toUpperCase() method returns a new string with letters converted to uppercase while leaving the original string unchanged.

const text = "Welcome to Plus2net";
const upper = text.toUpperCase();
console.log(upper); // WELCOME TO PLUS2NET

toUpperCase() syntax Top ↑

string.toUpperCase()

No argument is required.

Original string remains unchanged Top ↑

const original = "JavaScript";
const changed = original.toUpperCase();
console.log(original); // JavaScript
console.log(changed);  // JAVASCRIPT

Convert text interactively Top ↑

Result:

input.addEventListener('input', () => {
  result.textContent = input.value.toUpperCase();
});

See the related keyboard event tutorial.

Normalize text before a simple comparison Top ↑

const role = "ADMIN";
if (role.toUpperCase() === "ADMIN") {
  console.log("Matched");
}

Locale-sensitive uppercase Top ↑

const word = "istanbul";
console.log(word.toLocaleUpperCase("tr"));

Use toLocaleUpperCase() when language-specific casing matters.

Common mistakes Top ↑

Remember that this method returns a new string. It is a display/data-normalization tool, not a complete solution for locale-aware searching or authentication checks.

Previous / String Reference Next related topic




Subscribe to our YouTube Channel here



plus2net.com







Prakash

11-03-2010

Well Useful



We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2026   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer