3-16自己在html文件中是这样编写的,最后效果该如何实现呢?

来源:3-16 编程练习

Vigorous阿炎

2020-10-27 21:04:44

        var str="Never deter till tomorrow that which you can do today";

        str.indexOf('tomorrow');

        str.substr(17,8)

        'tomorrow'.toUpperCase()


在这里输入代码,可通过选择【代码语言】突出显示

写回答

2回答

好帮手慕慕子

2020-10-28

同学你好,第二次粘贴的代码效果是正确的,能够自己发现并解决问题,真棒!!祝学习愉快~

0

Vigorous阿炎

提问者

2020-10-27

老师不用了,我刚看到别人的代码了。明白了。
<!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.substr(index, 8);//补充代码
    var upperStr=str.substring(0, index) + strNew.toUpperCase() + str.slice(index+8, str.length);//补充代码
document.write(upperStr);
</script>
</body>
</html>


0

0 学习 · 15276 问题

查看课程