当前位置:网站首页>JS uses for in and for of to simplify ordinary for loops
JS uses for in and for of to simplify ordinary for loops
2022-07-27 15:36:00 【polite】
let arr = [10, 20, 30, 40];
// Common writing
for (let i = 0; i < arr.length; i++) {
console.log(arr[i]);
}
// Abbreviation
for (const val of arr) {
console.log(val);
}
for (const index in arr) {
console.log(arr[index]);
}
边栏推荐
猜你喜欢

Several basic uses of tl431-2.5v voltage reference chip
![[TensorBoard] OSError: [Errno 22] Invalid argument处理](/img/bf/c995f487607e3b307a268779ec1e94.png)
[TensorBoard] OSError: [Errno 22] Invalid argument处理

后台返回来的是这种数据,是什么格式啊

【剑指offer】面试题42:连续子数组的最大和——附0x80000000与INT_MIN

Watermelon book machine learning reading notes Chapter 1 Introduction

Google team launches new transformer to optimize panoramic segmentation scheme CVPR 2022

【剑指offer】面试题45:把数组排成最小的数

Fluent -- layout principle and constraints

Spark 3.0 Adaptive Execution 代码实现及数据倾斜优化

【剑指offer】面试题54:二叉搜索树的第k大节点
随机推荐
华为鸿蒙模拟器去除顶部导航栏方法
Alibaba's latest summary 2022 big factory interview real questions + comprehensive coverage of core knowledge points + detailed answers
Network equipment hard core technology insider router Chapter 16 dpdk and its prequel (I)
使用解构交换两个变量的值
【剑指offer】面试题39:数组中出现次数超过一半的数字
设置提示框位置随鼠标移动,并解决提示框显示不全的问题
Spark TroubleShooting整理
Network equipment hard core technology insider router Chapter 17 dpdk and its prequel (II)
shell脚本读取文本中的redis命令批量插入redis
JS find the maximum and minimum values in the array (math.max() method)
USB interface electromagnetic compatibility (EMC) solution
Network equipment hard core technology insider router Chapter 3 Jia Baoyu sleepwalking in Taixu Fantasy (middle)
HaoChen CAD building 2022 software installation package download and installation tutorial
Huawei's general card identification function enables multiple card bindings with one key
扩展Log4j支持日志文件根据时间分割文件和过期文件自动删除功能
Spark 本地程序启动缓慢问题排查
JS uses extension operators (...) to simplify code and simplify array merging
Leetcode 90. subset II backtracking /medium
Spark 3.0 DPP实现逻辑
Spark RPC