用法: string.toUpperCase() string:要转换为大写的字符串。 例子:在这里,toUpperCase()方法被调用str字符串,将所有小写字母转换为大写。得到的字符串,"HELLO WORLD", 被赋值给变量upperStr. Javascript conststr ="hello world";constupperStr = str.toUpperCase();console.log(upperStr);// Output: "HELLO WORL...
To convert a string to uppercase, we can use the built-in method in JavaScript. Here is an example that converts a string to uppercase…
In an earlier article, we looked at different ways to capitalize the first letter of a string to uppercase in JavaScript. In this article, you'll learn how to uppercase or lowercase a string using JavaScript. JavaScript provides two built-in functions for converting strings to uppercase and ...
JavaScript // JavaScript StringtoUpperCase() method// to convert string to Uppercasefunctionfunc(){// Original stringletstr ='It iS a 5r&:ampe@@t Day.'// String converted to Upper Caseletstring = str.toUpperCase();console.log(string); } func(); 输出: IT IS A 5R&:AMPE@@T DAY. ...
This JavaScript tutorial explains how to use the string method called toUpperCase() with syntax and examples. In JavaScript, toUpperCase() is a string method that is used to convert a string to uppercase.
The toUpperCase() method returns the string converted to uppercase. Example const message = "javascript is fun"; // convert message to uppercase const upperMessage = message.toUpperCase(); console.log(upperMessage); // Output: JAVASCRIPT IS FUN Run Code toUpperCase() Syntax The syntax of ...
ThetoUpperCase()method converts a string to uppercase letters. ThetoUpperCase()method does not change the original string. See Also: The toLowerCase() Method The toLocaleLowerCase() Method The toLocaleUpperCase() Method Syntax string.toUpperCase() ...
In JavaScript, toLocaleUpperCase() is a string method that is used to convert a string to uppercase based on locale. Because the toLocaleUpperCase() method is a method of the String object, it must be invoked through a particular instance of the String class.Syntax...
write("String str = ", str); document.write("After converting a specific character '", str.charAt(9), "' into in uppercase: "); document.write(str.charAt(9).toUpperCase()); OutputThe above program converts a specific character 'p' to a uppercase.String str = Tutorialspoint After...
JavaScript provides several built-in methods for manipulating strings, including one called toUpperCase() which can be used to convert the first letter of a string to uppercase.