Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use either <a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/toLowerCase" rel="noreferrer">toLowerCase</a> or <a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/toLocaleLowerCase" rel="noreferrer">toLocaleLowerCase</a> methods of the <a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String" rel="noreferrer">String</a> object. The difference is that <code>toLocaleLowerCase</code> will take current locale of the user/host into account. As per § 15.5.4.17 of the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm" rel="noreferrer">ECMAScript Language Specification (ECMA-262)</a>, <code>toLocaleLowerCase</code>…</p> <blockquote> <p>…works exactly the same as toLowerCase 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.</p> </blockquote> <p>Example:</p> <pre><code>var lower = 'Your Name'.toLowerCase(); </code></pre> <p>Also note that the <code>toLowerCase</code> and <code>toLocaleLowerCase</code> functions are implemented to work generically on <em>any</em> value type. Therefore you can invoke these functions even on non-<code>String</code> objects. Doing so will imply automatic conversion to a string value prior to changing the case of each character in the resulting string value. For example, you can <em>apply</em> <code>toLowerCase</code> directly on a date like this:</p> <pre><code>var lower = String.prototype.toLowerCase.apply(new Date()); </code></pre> <p>and which is effectively equivalent to:</p> <pre><code>var lower = new Date().toString().toLowerCase(); </code></pre> <p>The second form is generally preferred for its simplicity and readability. On earlier versions of IE, the first had the benefit that it could work with a <code>null</code> value. The result of applying <code>toLowerCase</code> or <code>toLocaleLowerCase</code> on <code>null</code> would yield <code>null</code> (and not an error condition).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload