当前位置:网站首页>How many way of calling a function?
How many way of calling a function?
2022-08-03 22:26:00 【Chinese front end】
In JavaScriptThere are 4 ways to call a function.Call to determine the function's value or "owner" object.this
- Call as a function - If a function is not called as a method, constructor, or using the
apply,callmethods, it is called byCalled as a function.The "owner" object for this function will be thewindowobject.
//Global Scopefunction add(a,b){console.log(this);return a + b;}add(1,5); // logs the "window" object and returns 6const o = {method(callback){callback();}}o.method(function(){console.log(this); // logs the "window" object});- Call as method - if the object's property has the value of the function,
边栏推荐
- 【云原生实用技巧】使用 skopeo 批量同步 helm chart 依赖镜像
- Work Subtotal QT Packing
- 386. Lexicographical Numbers
- 【开源框架】国内首个通用云计算框架,任意程序都可做成云计算。
- 剑指offer第22题-链表中倒数第K个节点
- Data_web(九)mongodb增量同步到mongodb
- Nine ways to teach you to read the file path in the resources directory
- Optimize the query (work in progress)
- 488. Zuma Game
- Internet user account information management regulations come into effect today: must crack down on account trading and gray products
猜你喜欢
随机推荐
什么是memoization,它有什么用?
如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
noip初赛
剑指offer第22题-链表中倒数第K个节点
优化查询(工作中)
藏宝计划TreasureProject(TPC)系统模式开发技术原理
PowerMockup 4.3.4::::Crack
目标检测的国内外研究现状
pikachu Over permission 越权
数据一致性:双删为什么要延时?
CAS:153162-70-0_N-BOC-6-Biotinamidohexylamine
Network basic learning series four (network layer, data link layer and some other important protocols or technologies)
HCIP第十五天
直播预告 | 构建业务智联,快速拥抱财务数字化转型
October 2019 Twice SQL Injection
嵌入式系统:概述
Embedded Systems: GPIO
VLAN实验
【刷题篇】二叉树的右视图
start with connect by 实现递归查询
![[N1CTF 2018] eating_cms](/img/09/3599d889d9007eb45c6eab3043f0c4.png)








