JS—字符串的toUpperCase

51 阅读1分钟

1.概述

toUpperCase( )将字符串转化为大写形式,返回一个新字符串,不改变原字符串

2.语法

str.toUpperCase( )

1)参数

toUpperCase( )无参数

2)返回值

返回一个新字符串,不改变原字符串

3.案例使用

const str= "hello,how are you";
console.log(str.toUpperCase())   //HELLO,HOW ARE YOU
console.log(str)   //hello,how are you