请老师检查作业

来源:2-7 编程练习

听的说

2022-01-17 13:47:13

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>

<body>
<script>
const arr = ["i", "m", "o", "o", "c"]
//    在此补充代码
let i = 0;
for (const [index, value] of arr.entries()) {
console.log(value);
if (value == "o") {
arr[index] = value.toUpperCase();
break;
}
}
console.log(arr);
</script>
</body>

</html>


写回答

1回答

好帮手慕然然

2022-01-17

同学你好,代码实现很棒,以下位置处定义的变量 i 没有用到,可以删除:

https://img.mukewang.com/climg/61e504a2090c4f3806470321.jpg

祝学习愉快!

0

0 学习 · 17877 问题

查看课程