Javascript将小写字母转为大写的方法

文章封面

题目:将:“America”、“Greece”、“Britain”、“Canada”、“China”、“Egypt”各个字符串 统一改为大写

toUpperCase() 方法用于把字符串转换为大写。

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        var str="America, Greece, Britain,Canada,China,Egypt";
        document.write(str+"<br/>");
       document.write(str.toUpperCase());

        </script>
</body>
</html>

结果:image

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0