当前位置:网站首页>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]);
}
边栏推荐
- 使用Prometheus监控Spark任务
- Comparison of advantages and disadvantages between instrument amplifier and operational amplifier
- [系统编程] 进程,线程问题总结
- 西瓜书《机器学习》阅读笔记之第一章绪论
- 【剑指offer】面试题55 - Ⅰ/Ⅱ:二叉树的深度/平衡二叉树
- 使用双星号代替Math.pow()
- 初探JuiceFS
- 股票开户佣金优惠,炒股开户哪家证券公司好网上开户安全吗
- Four kinds of relay schemes driven by single chip microcomputer
- Problem solving in magic tower project
猜你喜欢

Several basic uses of tl431-2.5v voltage reference chip

Spark 任务Task调度异常分析
![[daily question 1] 558. Intersection of quadtrees](/img/96/16ec3031161a2efdb4ac69b882a681.png)
[daily question 1] 558. Intersection of quadtrees

谷粒商城配置CorsWebFilter后,报错:Resource sharing error:MultipleAllowOriginValues

MySQL interview 40 consecutive questions, interviewer, if you continue to ask, I will turn my face

【剑指offer】面试题46:把数字翻译成字符串——动态规划

3.3-5v conversion

Pictures to be delivered

Fluent -- layout principle and constraints

Dan bin Investment Summit: on the importance of asset management!
随机推荐
【剑指offer】面试题45:把数组排成最小的数
Network equipment hard core technology insider router Chapter 13 from deer by device to router (Part 1)
使用双星号代替Math.pow()
[daily question 1] 558. Intersection of quadtrees
西瓜书《机器学习》阅读笔记之第一章绪论
设置提示框位置随鼠标移动,并解决提示框显示不全的问题
Spark 本地程序启动缓慢问题排查
JS uses unary operators to simplify string to number conversion
【剑指offer】面试题49:丑数
[TensorBoard] OSError: [Errno 22] Invalid argument处理
Leetcode-1737- minimum number of characters to change if one of the three conditions is met
How to edit a framework resource file separately
Network equipment hard core technology insider router Chapter 21 reconfigurable router
QT (XIII) qchart drawing line chart
QT (five) meta object properties
JS uses extension operators (...) to simplify code and simplify array merging
Selenium reports an error: session not created: this version of chromedriver only supports chrome version 81
使用Lombok导致打印的tostring中缺少父类的属性
Spark Filter算子在Parquet文件上的下推
MySQL interview 40 consecutive questions, interviewer, if you continue to ask, I will turn my face