網站首頁 編程語言 正文
arguments是存在AO中的類數組對象
可以使用length和index
但是不能使用數組的一些方法,比如forEach、map
function foo(num1, num2, num3) {
// 類數組對象中(長的像是一個數組, 本質上是一個對象): arguments
// callee獲取當前arguments所在的函數
console.log(arguments.callee)//foo(){}
// arguments.callee()---這樣寫會遞歸
}
如何將arguments轉化成數組類型
1.for循環遍歷arguments
2.
Array.prototype.slice將arguments轉成array
var newArr2 = Array.prototype.slice.call(arguments)
console.log(newArr2)
原文鏈接:https://blog.csdn.net/weixin_44283589/article/details/123733560
- 上一篇:es6及之后的剩余參數
- 下一篇:es6實現數組對象深度去重
相關推薦
- 2022-10-31 Python3邏輯運算符與成員運算符_python
- 2022-05-29 Redis?哨兵機制及配置實現_Redis
- 2022-03-01 show-overflow-tooltip實現表格列內容過長顯示提示
- 2022-08-30 Kafka中產生數據積壓的原因以及解決方案
- 2022-08-02 Shell判斷字符串變量是否為空的方法實現_linux shell
- 2022-06-21 Git基礎之git與SVN版本控制優缺點區別分析_其它綜合
- 2023-01-17 Linux?ps命令詳解及Linux查看進程的操作方法_linux shell
- 2023-03-22 swift依賴注入和依賴注入容器詳解_Swift
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支