3-31问题
来源:3-31 编程练习
qq_一个人一個人_0
2018-07-26 11:47:23
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首字母变大写</title>
</head>
<body>
<script>
var str="all time is no time when it is past";
var a=str.split(" "),b="";
for(var i=0;i<str.length;i++){
b=a[i].charAt(0).toUpperCase();
}
console.log(a);
</script>
</body>
</html>老师您好,为什么我的会报Cannot read property 'charAt' of undefined错,哪里有问题吗
1回答
经过测试 ,代码如下修改:

完善一下哦, 祝学习愉快 ,望采纳