对于主机区域设置,如何在 JavaScript 中将字符串转换为小写字母?

htmlprogramming scriptsjavascript

要在 JavaScript 中将字符串转换为小写字母,请使用 toLocaleLowerCase() 方法。

示例

您可以尝试运行以下代码来了解如何在 JavaScript 中使用 toLocaleLowerCase() 方法 −

<!DOCTYPE html>
<html>
   <body>
      <script>
         var a = "WELCOME!";
         document.write(a.toLocaleLowerCase());
      </script>
   </body>
</html>

相关文章