JS: String.prototype.toLowerCase

By Xah Lee. Date: .


s.toUpperCase() → return a string of upper case version of string s.

console.log ( "abc".toUpperCase() === "ABC" ); // true

// works on Greek or any unicode that has upper/lower case defined
console.log ( "αβχ".toUpperCase() === "ΑΒΧ" ); // true


s.toLowerCase() → return a string of lower case version of string s.

console.log ( "ABC".toLowerCase() === "abc" ); // true
console.log ( "ΑΒΧ".toLowerCase() === "αβχ" ); // true

ECMAScript 2015 §Text Processing#sec-string.prototype.touppercase

ECMAScript 2015 §Text Processing#sec-string.prototype.tolowercase

toLocaleUpperCase, toLocaleLowerCase

s.toLocaleUpperCase() → same as s.toUpperCase(), except that it may be different in some languages (For example, Turkish). JavaScript implementation may not chose to have this behavior. In that case, its identical to s.toUpperCase().

Here's quote from spec:

An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement the toLocaleUpperCase method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of the toLocaleUpperCase method is used.

This function interprets a String value as a sequence of UTF-16 encoded code points, as described in 6.1.4.

This function works exactly the same as toUpperCase except that its result is intended to yield the correct result for the host environment’s current locale, rather than a locale-independent result. There will only be a difference in the few cases (such as Turkish) where the rules for that language conflict with the regular Unicode case mappings.


ECMAScript 2015 §Text Processing#sec-string.prototype.tolocaleuppercase

ECMAScript 2015 §Text Processing#sec-string.prototype.tolocalelowercase

RegExp Topic

  1. JS: RegExp Tutorial
  2. JS: RegExp Syntax
  3. JS: Regex Find/Replace
  4. JS: RegExp Object
  5. JS: RegExp Constructor
  6. JS: RegExp.prototype

JS String

  1. String Overview
  2. Template String
  3. Char, Code Unit, Code Point
  4. String Escape Sequence
  5. Unicode Escape Sequence
  6. String to Number
  7. Encode URL, Escape String
  8. Format Number
  9. Source Code Encoding
  10. Allowed Characters in Identifier
  11. String Object
  12. String.prototype
Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog