哈喽 大家早上好 请教一下代码怎么纠正?
来源:3-28 编程练习
weibo_纷纷的想念_0
2017-03-09 08:07:56
<!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.slice(index,index+8);//补充代码
var upperStr=str.replace('tommorrow',strNew.toUpperCase());//补充代码
document.write(upperStr);
</script>
</body>
</html>
想让整句都输出 同时tomorrow大写,代码要怎么样写呢?
1回答
你的方法是正确的. 不过这个地方的"tomorrow"拼写错误:
var upperStr=str.replace('tommorrow',strNew.toUpperCase());
相似问题