JavaScript toUpperCase 方法用于将给定字符串转换为大写字母,其语法是:
String_Object.toUpperCase()
toUpperCase 示例
以下示例集将帮助您理解 JS toUpperCase 函数。
<!DOCTYPE html>
<html>
<head>
<title> Js Example </title>
</head>
<body>
<h1> Example </h1>
<script>
var Str1 = "Learn JavaScript at Tutorial Gateway";
var Str3 = Str1.toUpperCase();
var Str4 = "Hi, This is From JS".toUpperCase();
var Str5 = "javascript uppercase".toUpperCase();
document.write(" <b> Uppercase Letters are: </b> " + Str3);
document.write(" <br \> <b> Uppercase Letters are: </b> " + Str4);
document.write(" <br \> <b> Uppercase Letters are: </b> " + Str5);
</script>
</body>
</html>
