【第5周 js数据类型】toUpperCase()括号里面可以写内容吗?

来源:3-16 编程练习

easyschen

2021-11-25 12:00:39

问题描述:

toUpperCase()括号里面可以写内容吗?


相关截图:

https://img.mukewang.com/climg/619f0a2509fc80aa11720890.jpg


相关代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>toUpperCase和toLowerCase</title>
</head>
<body>
<script>
    var str="Never deter till tomorrow that which you can do today";
//
var index = str.substring(17,25);

var strNew=index.toUpperCase();

//

var upperStr= 'Never deter till '+ strNew + ' that which you can do today';
        
    document.write(upperStr); 
</script>
</body>
</html>


写回答

1回答

好帮手慕星星

2021-11-25

同学你好,代码实现效果很棒!

另外toUpperCase()括号中不需要参数,是字符串来调用toUpperCase()方法。

祝学习愉快!

0

0 学习 · 15276 问题

查看课程