当前位置:网站首页>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,
边栏推荐
- 图的基础概念
- Network basic learning series four (network layer, data link layer and some other important protocols or technologies)
- [MySQL Advanced] Creation and Management of Databases and Tables
- UVa 10003 - Cutting Sticks (White Book, Interval DP)
- Recognized by International Authorities | Yunzhuang Technology was selected in "RPA Global Market Pattern Report, Q3 2022"
- start with connect by 实现递归查询
- Diazo Biotin-PEG3-DBCO | Diazo Compound Modified Biotin-Tripolyethylene Glycol-Dibenzocyclooctyne
- HCIP第十六天
- 云计算国内外发展现状
- websocket多线程发送消息报错TEXT_PARTIAL_WRITING--自旋锁替换synchronized独占锁的使用案例
猜你喜欢

Adobe是什么?

嵌入式系统:时钟

七夕快乐!

静态文件快速建站

重发布实验报告

FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment

encapsulation, package, access modifier, static variable
![[b01lers2020]Life on Mars](/img/d0/d5c9b7224542c8843ce29adc7ef713.png)
[b01lers2020]Life on Mars

On the Qixi Festival of 2022, I will offer 7 exquisite confession codes, and at the same time teach you to quickly change the source code for your own use

封装、包、访问权限修饰符、static变量
随机推荐
Zilliz 2023 秋季校园招聘正式启动!
Golang Chapter 1: Getting Started
382. Linked List Random Node
藏宝计划TreasureProject(TPC)系统模式开发技术原理
决策树、GBDT、XGBOOST树的可视化
2022-08-02 mysql/stonedb slow SQL-Q18 - memory usage surge analysis
CAS:153162-70-0_N-BOC-6-Biotinamidohexylamine
start with connect by 实现递归查询
navicat 连接 mongodb 报错[13][Unauthorized] command listDatabases requires authentication
488. Zuma Game
113. Teach a Man how to fish - How to query the documentation and technical implementation details of any SAP UI5 control property by yourself
Codeup brushing notes - simple simulation
用于流动质押和收益生成的 Web3 基础设施
网络基础学习系列四(网络层,数据链路层和一些其他重要协议或技术)
Nine ways to teach you to read the file path in the resources directory
Cisco ike2 IPSec配置
websocket多线程发送消息报错TEXT_PARTIAL_WRITING--自旋锁替换synchronized独占锁的使用案例
L2-041 插松枝
E-commerce data warehouse ODS layer-----log data loading
start with connect by implements recursive query