麻烦老师帮忙查看并优化一下代码,谢谢~

来源:3-29 编程练习

慕粉2243585596

2020-05-13 22:17:50

<!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.indexOf("tomorrow");//补充代码
var strNew=str.substring(index,index+8);//补充代码
var upperStr=str.replace(strNew,strNew.toUpperCase());//补充代码
document.write(upperStr);  
</script> 
</body>
</html>


写回答

1回答

好帮手慕言

2020-05-14

同学你好,效果是正确的,代码很简洁,不需要优化了,继续加油,祝学习愉快~

0

0 学习 · 40143 问题

查看课程