首页 编程 正文

js toUpperCase() 把字符串转换为大写(js 转换大小写)

2023-10-09 09:34 23
admin

通过 toUpperCase() 把字符串转换为大写:

实例

var text1 = "Hello World!";       // 字符串
var text2 = text1.toUpperCase();  // text2 是被转换为大写的 text1

亲自试一试

通过 toLowerCase() 把字符串转换为小写:

实例

var text1 = "Hello World!";       // 字符串
var text2 = text1.toLowerCase();  // text2 是被转换为小写的 text1