--- title: String.prototype.toLowerCase() slug: Web/JavaScript/Reference/Global_Objects/String/toLowerCase translation_of: Web/JavaScript/Reference/Global_Objects/String/toLowerCase ---
{{JSRef}}

toLowerCase() 函式会回传将字符串转换为英文小写字母后的结果。

{{EmbedInteractiveExample("pages/js/string-tolowercase.html")}}

语法

str.toLowerCase()

回传值

回传一组将原字串英文内容转换成英文小写字母后的结果。

描述

The toLowerCase() 函式会回传一组将原字符串英文内容转换成英文小写字母后的结果。 toLowerCase() 并不会影响到原字符串 str 的内容值。

范例

使用toLowerCase()

console.log('ALPHABET'.toLowerCase()); // 'alphabet'

规范

规范 状态 注解
{{SpecName('ES1')}} {{Spec2('ES1')}} Initial definition. Implemented in JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.5.4.16', 'String.prototype.toLowerCase')}} {{Spec2('ES5.1')}}
{{SpecName('ES6', '#sec-string.prototype.tolowercase', 'String.prototype.toLowerCase')}} {{Spec2('ES6')}}
{{SpecName('ESDraft', '#sec-string.prototype.tolowercase', 'String.prototype.toLowerCase')}} {{Spec2('ESDraft')}}

浏览器相容性

{{Compat("javascript.builtins.String.toLowerCase")}}

参考