当前位置:网站首页>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]);
}
边栏推荐
- Use deconstruction to exchange the values of two variables
- HJ8 合并表记录
- Lua study notes
- 2022-07-27 Daily: IJCAI 2022 outstanding papers were published, and 298 Chinese mainland authors won the first place in two items
- Spark 3.0 测试与使用
- 扩展Log4j支持日志文件根据时间分割文件和过期文件自动删除功能
- Problem solving in magic tower project
- Sword finger offer merges two sorted linked lists
- Unity performance optimization ----- LOD (level of detail) of rendering optimization (GPU)
- DevEco Studio2.1运行项目报错
猜你喜欢

After configuring corswebfilter in grain mall, an error is reported: resource sharing error:multiplealloworiginvalues

学习Parquet文件格式

Spark 任务Task调度异常分析

STL value string learning

How to take satisfactory photos / videos from hololens

Leetcode interview question 17.21. water volume double pointer of histogram, monotonic stack /hard
USB interface electromagnetic compatibility (EMC) solution

Unity performance optimization ----- occlusion culling of rendering optimization (GPU)

flutter —— 布局原理与约束

Fluent -- layout principle and constraints
随机推荐
Unity performance optimization ----- drawcall
Spark 任务Task调度异常分析
Leetcode-1737- minimum number of characters to change if one of the three conditions is met
【剑指offer】面试题42:连续子数组的最大和——附0x80000000与INT_MIN
Network equipment hard core technology insider router 19 dpdk (IV)
Lua study notes
Simple mathematical knowledge related to 3D
$router.back(-1)
Spark TroubleShooting整理
Spark Bucket Table Join
Leetcode 190. reverse binary bit operation /easy
【剑指offer】面试题53-Ⅰ:在排序数组中查找数字1 —— 二分查找的三个模版
3.3-5v conversion
HaoChen CAD building 2022 software installation package download and installation tutorial
使用解构交换两个变量的值
The reverse order pairs in the "sword finger offer" array
华为鸿蒙模拟器去除顶部导航栏方法
Spark Filter算子在Parquet文件上的下推
Spark 3.0 测试与使用
EMC design scheme of USB2.0 Interface