JavaScript for 循环
JavaScript 大约 430 字代码
const arr = [3, 5, 7];
arr.foo = 'hello';
for (const i in arr) {
console.log(i); // "0", "1", "2", "foo"
}
for (const i of arr) {
console.log(i); // 3, 5, 7, undefined
}
arr.forEach((e) => {
console.log(e); // 3, 5, 7, undefined
})
文档
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
阅读 57 · 发布于 2023-01-18
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Ubuntu 安装 Docker阅读 945
-
移动端使用 Chrome 开发者工具调试网页阅读 1610
-
Android adb 命令阅读 3730
-
Spring Cloud OpenFeign 使用指定配置阅读 264
-
Linux jobs fg bg disown阅读 2197
-
Android 使用 CountDownTimer 类进行倒计时阅读 1444
-
Spring Boot jar 包执行报 no main manifest attribute 错误阅读 440
-
Prometheus+Grafana+rabbitmq_prometheus 监控 RabbitMQ阅读 1069
-
Git 撤销 commit 和回退到指定 commit阅读 4768
-
Linux 命令之查看进程线程数量阅读 4689