当前位置:网站首页>js的call()和apply()
js的call()和apply()
2022-06-25 04:00:00 【刘家奕_】
call()和apply()
-这两个方法都是函数对象的方法,需要通过函数对象来调用
-当对函数调用call()和apply()都会调用函数执行
-在调用call()和apply()可以将一个对象指定为第一个参数
此时这个对象将会成为函数执行时的this
- call()方法可以将实参在对象之后依次传递
- apply()方法需要将实参封装到一个数组中统一传递
- this的情况:
1.以函数形式调用时,this永远都是window
2.以方法的形式调用时,this是调用方法的对象
3.以构造函数的形式调用时,this是新创建的那个对象
4.使用call和apply调用时,this是指定的那个对象
边栏推荐
- 论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)
- 坐标系左乘右乘
- GBASE 8s的隔离级别介绍
- Vigilance against over range collection of privacy - ten mobile app violations
- mongodb集群
- Lecture record: data processing methods and applications of various spatial geodetic techniques
- GBASE 8s活锁、死锁问题的解决
- Gbase 8s stored procedure execution and deletion
- OBS Browser+浏览器的基本使用
- 2021.8.29 notes: register, bit operation, pointer, structure
猜你喜欢

A detailed summary of TCP connection triple handshake

GBASE 8s 总体架构

"How to carry out industrial positioning" in local / Park industrial planning

Laravel document sorting 4. Controller

地方/園區產業規劃之 “ 如何進行產業定比特 ”

论文阅读《LSD-SLAM: Large-Scale Direct Monocular SLAM》

Finereport (sail soft) handling the problem that the histogram data label is blocked

单元测试覆盖率

Office macro virus bounce shell experiment
![LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路](/img/ad/69fce7cf064479a0ddd477fb935de2.png)
LeetCode 剑指Offer II 091 粉刷房子[动态规划] HERODING的LeetCode之路
随机推荐
What is the storage engine and the three common database storage engines for MySQL
什么是存储引擎以及MySQL常见的三种数据库存储引擎
论文笔记: 多标签学习 ESMC (没看懂, 还没写出来, 暂时放这里占个位置)
GBASE 8s存储过程执行和删除
1、项目第二阶段——用户注册和登陆
GBASE 8s的级联删除功能
GBASE 8s的数据视图
php封装curl发送get、post请求方法,并使用
Anaconda安装+TensorFlow安装+Keras安装+numpy安装(包含镜像和版本信息兼容问题)
PostgreSQL数据库WAL——RM_HEAP_ID日志记录动作
CTF_ Web: Advanced questions of attack and defense world expert zone WP (19-21)
Openmmlab environment configuration
使用文本分析识别一段文本中的主要性别
Gbase 8s stored procedure flow control
Coinlist how to operate the middle lot number security tutorial
单元测试覆盖率
Musk released humanoid robot. Why is AI significant to musk?
GBASE 8s中DELIMIDENT环境变量的使用
kenlm
冰冰学习笔记:循环队列的实现