1const numbers = [1, 2, 3, 4, 5, 6]; 2 3numbers.forEach((num, index) => { 4 if (num === 3) { 5 console.log(`遇到数字 3,使用 return 跳过`); 6 return; 7 } 8 if (num === 5) { 9 console.log(`遇到数字 5,使用 return 跳过`); 10 return; 11 } 12 console.log(`处理数字: ${num}, 索引: ${index}`); 13});
参考答案:
最近更新时间:2025-08-25
题库维护不易,您的支持就是我们最大的动力!