请老师检查作业
来源: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回答
同学你好,代码实现很棒,以下位置处定义的变量 i 没有用到,可以删除:
祝学习愉快!